IrrLicht core::array slow?

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
SwiftCoder
Posts: 32
Joined: Thu Jan 15, 2004 7:33 pm
Location: Carribean

IrrLicht core::array slow?

Post by SwiftCoder »

Ok, so I just compiled IrrLicht again after a long hiatus, and I decided to test the performance of the array and list classes against the std-library.
I put together a few simple tests and received some interesting results.

Using gcc 4 on my MacBook Pro (Intel Core Duo, OS 10.4), using the installed version of libstdc++ against todays svn sources of IrrLicht, std::vector trounced irr::core::array, while irr::core::list managed to hold its ground against std::list, typically coming out ahead.

The tests were run at -O2 optimisation, with a 100,000 element dataset, but the disparity only increased at -O3. There may be some discrepancies due to the lack of matching functions between the two libraries.

I have packaged up my test programs, should compile and run on any *nix, you can download it here: http://www.drivehq.com/web/swiftcoder/performance.tgz . I would be interested in seeing some numbers from other machine/OS/compiler combinations.

Here are the actual numbers, for those who don't wish to run the programs for your selves:

testing std c++ library containers...

std::vector append: 0 sec 5167 usec
std::vector erase first: 5 sec 110466 usec
std::vector prepend: 5 sec 258655 usec
std::vector erase last: 0 sec 110 usec
std::list append: 0 sec 19770 usec
std::list erase first: 0 sec 16164 usec
std::list prepend: 0 sec 15347 usec
std::list erase last: 0 sec 16423 usec


testing IrrLicht 3d engine library containers...

irr::core::array append: 0 sec 5790 usec
irr::core::array erase first: 18 sec 810264 usec
irr::core::array prepend: 15 sec 42079 usec
irr::core::array erase last: 0 sec 218 usec
irr::core::list append: 0 sec 18987 usec
irr::core::list erase first: 0 sec 15548 usec
irr::core::list prepend: 0 sec 14535 usec
irr::core::list erase last: 0 sec 15566 usec
Edit: stupid hosting, remove the .exe from the file, it is actually a .tgz
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Well, the numbers are not really problematic. The docs say that you should avoid touching the front of an array, and all other differences are within the measurement accuracy.
SwiftCoder
Posts: 32
Joined: Thu Jan 15, 2004 7:33 pm
Location: Carribean

Post by SwiftCoder »

hybrid wrote:Well, the numbers are not really problematic. The docs say that you should avoid touching the front of an array, and all other differences are within the measurement accuracy.
True enough.

For interests sake, I booted the same machine into Ubuntu, and performed the tests again. Interestingly enough, the results were very differently balanced, leading me to believe that Apple's gcc probably optimises differently.
testing IrrLicht 3d engine library containers...

irr::core::array append: 0 sec 20847 usec
irr::core::array erase first: 11 sec 321184 usec
irr::core::array prepend: 11 sec 287461 usec
irr::core::array erase last: 0 sec 2 usec
irr::core::list append: 0 sec 14361 usec
irr::core::list erase first: 0 sec 4986 usec
irr::core::list prepend: 0 sec 9262 usec
irr::core::list erase last: 0 sec 5117 usec

testing std c++ library containers...

std::vector append: 0 sec 7270 usec
std::vector erase first: 5 sec 556373 usec
std::vector prepend: 6 sec 94008 usec
std::vector erase last: 0 sec 84 usec
std::list append: 0 sec 30195 usec
std::list erase first: 0 sec 1790 usec
std::list prepend: 0 sec 11997 usec
std::list erase last: 0 sec 11008 usec
Post Reply