On Fri, May 12, 2006 at 07:23:10PM -0400, Achilleas Anastasopoulos wrote: > Ilia, > > I did profile two versions of the code (one with ANCI-C > and another with C++ STL <vector>). > It seems that the bottleneck is in accessing <vector> > elements which is more expensive than accessing simple > array elements. > > As an example > vector<int> x; > x[10]; > > is much slower than > > int *y; > y[10] > > > The reason i started with <vector> was the clean way that > these were instantiated, etc. > > Anyway, I am now reimplementing the code without using <vector>; > will get back to you on this.
Achilleas, I think you're barking up the wrong tree. There's no reason that reading or writing x[foo] should be slower than y[foo] particularly in a loop. The compiler will load the underlying pointer into a register and perform a simple indexed load or store. If you're so inclined, objdump -d example.o or objdump -d example will show you disassembled code. Eric _______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org http://lists.gnu.org/mailman/listinfo/discuss-gnuradio