Anyways, to investigate this I wrote a small program to test the speed of populating and fetching data to/from regular 'ol malloc'd...dynamically allocated arrays and std::vector's... respectively.
While the test isn't extremely extensive, I believe it's sufficient.
Either way, the results are...disturbing to say in the least. This is with the \O2 'Full Speed' optimization flag on MSVC 2008:
Starting first test: Populating Speed...Populating dynamically allocated array...Populating vector...The dynamically allocated array took 0.0176ms to populate.The vector took 0.0396698ms to populate.A 2.25397 ratio difference in speed.Starting second test: Fetch Speed...Fetching data from dynamically allocated array.Fetching data from vector.The dynamically allocated array took: 0.00195556ms to fetch data.The vector took: 0.0312889ms to fetch data.A 16 ratio difference in speed.
This makes me want to reinvent the wheel...
I thought it might have been my code but when I asked a friend to test it on his GCC setup his results were drastically different... while I don't have his exact results he said "I compiled this on GCC and get slightly better results with the vector at -O2, populating on GCC 4.3.2 (-O2) was slightly slower, but fetching was faster. It might be interesting to figure out what is causing the issue."
I'm posting the full source code here in attempt to get a broader range of results from various platforms. So far it seems like it's a Microsoft specific issue.
Here's the source code:
VecTest.zip
If someone knows of something I don't know, please let me know. I'm interested in seeing your results.