[Halld-offline] stl vector
Paul Eugenio
eugenio at fsu.edu
Mon May 9 11:58:02 EDT 2011
Hi,
I have some code below which I compared stl vector<double> to dynamically generated double array. The code only compares data access not memory allocation. With stl vectors, the code takes more than twice as long to run. This is consistent to what I seen with more complicated data objects.
Paul
// double array
g++ stl-test.cc -o stl-test
140-182-249-79:~ eugenio$ time ./stl-test
real 0m4.327s
user 0m4.304s
sys 0m0.009s
// stl vector
140-182-249-79:~ eugenio$ make stl-test
g++ stl-test.cc -o stl-test
140-182-249-79:~ eugenio$ time ./stl-test
real 0m9.204s
user 0m9.151s
sys 0m0.012s
--
Prof. Paul Eugenio
Florida State University
Department of Physics
Tallahassee, Florida, USA 32306
(850) 644-2585
eugenio at fsu.edu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: stl-test.cc
Type: application/octet-stream
Size: 390 bytes
Desc: not available
URL: <https://mailman.jlab.org/pipermail/halld-offline/attachments/20110509/dd90f97c/attachment-0002.obj>
-------------- next part --------------
More information about the Halld-offline
mailing list