Efficiency Modification

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Efficiency Modification

mduggan32
Hi,
In rs_math.h, there are functions in the quadratic solver class that take in vectors of elements and then return the solved variables of the equation. I believe that these vectors, which are used for both the input and output of the quadratic solvers, could be replaced by statically allocated arrays which would allow for quicker random access and possibly less overhead with copy constructors for the std::vectors used in the class.
This is for a data structures class where we have to evaluate efficiency when we change data structures in a complex piece of code. What do y'all think? Do you see any problems with this modification?
Reply | Threaded
Open this post in threaded view
|

Re: Efficiency Modification

dxli
Hi,

I got used to use reference for input vectors, and rvalue reference for returned values. Since copy ctor won't be needed in the whole process.

Static arrays could be a potential source of bugs.

Since the code was written piece by piece over time, we need to review more and keep conformity. For example, std::vector used instead of QVector. By default QVector allows data sharing, therefore, copying of data only happens when necessary.

Right now, we have a unified solver for a set of two quadratic equations, which uses our own quartic equation solver. Therefore, we would like improve the performance (robustness) of the quartic solver. Our linear equation set solver is using Gaussian-Jordan algorithm, seems to be stable enough. Therefore, I have removed the boost-math solver for linear equation sets.

Thanks,

dxli

mduggan32 wrote
Hi,
In rs_math.h, there are functions in the quadratic solver class that take in vectors of elements and then return the solved variables of the equation. I believe that these vectors, which are used for both the input and output of the quadratic solvers, could be replaced by statically allocated arrays which would allow for quicker random access and possibly less overhead with copy constructors for the std::vectors used in the class.
This is for a data structures class where we have to evaluate efficiency when we change data structures in a complex piece of code. What do y'all think? Do you see any problems with this modification?