R
Rune Allnor
Hi all.
I have this application which is heavy on computations
on data scattered in RAM. The task is to generate
a triangulated surface from a set of scattered (x,y,z)
data. In this application the memory managment is
a big issue while computatiosn are relativley small
and uncompicated, so that run-time would be expected
to split about 50/50 between memory managment and
computations.
I expect to see a 50% slash in run-time by rewriting
the program from vector indexing presently on the form
std::vector<double> v;
double x;
std::vector<size_t> i;
size_t n;
x = v[i[n]];
to pointer dereferencing, _along_the_lines_of_
std::vector<double> v;
double x;
std::vector<*double> i;
size_t n;
// initialize the elements of i to point to elements of v
x = *i[n];
The point is that I can't afford much run-time overhead, or
it will signifigantly impact the application.
Now, there are several variants of computations that I can
do on the data x. I'd like to use function objects or pointers
to specify how to do the computations, and am thinking of
using boost.bind to declare these function pointers when
calling this library.
What run-time overheads, if any, would be expected when
using function pointers, as opposed to 'hard-wiring' the
computations inside the library?
Rune
I have this application which is heavy on computations
on data scattered in RAM. The task is to generate
a triangulated surface from a set of scattered (x,y,z)
data. In this application the memory managment is
a big issue while computatiosn are relativley small
and uncompicated, so that run-time would be expected
to split about 50/50 between memory managment and
computations.
I expect to see a 50% slash in run-time by rewriting
the program from vector indexing presently on the form
std::vector<double> v;
double x;
std::vector<size_t> i;
size_t n;
x = v[i[n]];
to pointer dereferencing, _along_the_lines_of_
std::vector<double> v;
double x;
std::vector<*double> i;
size_t n;
// initialize the elements of i to point to elements of v
x = *i[n];
The point is that I can't afford much run-time overhead, or
it will signifigantly impact the application.
Now, there are several variants of computations that I can
do on the data x. I'd like to use function objects or pointers
to specify how to do the computations, and am thinking of
using boost.bind to declare these function pointers when
calling this library.
What run-time overheads, if any, would be expected when
using function pointers, as opposed to 'hard-wiring' the
computations inside the library?
Rune