STL Saves or Enslaves?

Started by
72 comments, last by Promit 18 years ago
How wise is using STL containers (lists) in a fast-paced game instead of creating the sturctures form scratch? Hurts efficiency? More overhead which is noticeable to the player? Or slight drop in frame per second counter like q couple of frames? Thanks.
Advertisement
Depends on what you're doing. An STL list is a linked list and shares the same basic performance properties.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
Lets put it this way: You're probably not gonna be able to write a faster doubly linked list yourself ;)
I'd say that STL will give better performance than pretty much any home-brewn container, if used correctly. I highly recommend STL.
STL containers are extremely efficient when used properly.
This space for rent.
Quote:Original post by Mushu
I'd say that STL will give better performance than pretty much any home-brewn container, if used correctly. I highly recommend STL.


Ditto. And even if your linked list is somehow faster, it's not going to be more robust or cleaner than the STL implementation, which has been banged on for years by people much smarter than yourself. [grin]

And since some ppl here offend my intellignece "smarter than yourself," and "You're probably not gonna be able to write a faster..."

I say yup I can write much much faster close to the speed of photons and much faster and efficient doubly linked list with random access facility and sorting capabilities and memory management to beat up the hell out of the CPU and guess what, it runs on GPU using a shader language. Just kidding!

Anyway thanks for ur replies, I will go with STL.
If there's one STL container you CAN beat though, it would be the set, but only by caching or preallocating nodes for a binary search tree which I believe most implementations of set use.
Quote:Original post by quaker
And since some ppl here offend my intellignece "smarter than yourself," and "You're probably not gonna be able to write a faster..."


They're much smarter than the rest of us too. Some of the people working on the STL are the same people working on the C++ language itself -- people way smarter than you, or I, or probably anyone on this site are working on this stuff every day and making it more robust and solid.

Regardless of their intelligence, spending weeks re-writing most of the STL is just stupid. That time could be better spent writing game code, and I'm pretty sure you must have bigger performance sinks in there than the STL.
From the C++ FAQ Lite: Why should I use container classes rather than simple arrays?

This topic is closed to new replies.

Advertisement