Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EASTL versus STL, how can there be such a performance difference in std::vector<uint64_t>::operator[]

According to http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2271.html vector<uint64>::operator[] is between 2% and 70% faster in EASTL than a "commonly used commercial version of STL".

Unless the commercial version of STL uses range checking, which would make the comparison unfair, how can it possibly be such a speed difference for such a simple operation?

Update:

Seems the answer is that the EA engineers is simply cheating by comparing with a version which uses range checking...

like image 563
Viktor Sehr Avatar asked Apr 21 '11 10:04

Viktor Sehr


2 Answers

The document states that they used VC++ 2005 for Windows testing, with which checked iterators are enabled by default (yes, even for release builds; same goes for VC++ 2008). I suspect that the performance of operator[] wouldn't be any different if they added -D_SECURE_SCL=0 to their build command-line.

like image 114
ildjarn Avatar answered Nov 03 '22 09:11

ildjarn


I think this passage from the documentation will be crucial

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2271.html#eastl_allocator

It is apparently inspired by the famous 'Towards a better allocator model' article by Pablo Halpern

like image 29
sehe Avatar answered Nov 03 '22 11:11

sehe