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

☆樱花仙子☆ 提交于 2020-01-01 04:18:05

问题


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...


回答1:


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.




回答2:


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



来源:https://stackoverflow.com/questions/5742597/eastl-versus-stl-how-can-there-be-such-a-performance-difference-in-stdvector

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!