Sign in to follow this  

STL or Write-Your-Own?

This topic is 4162 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, For my current project, I need several types of containers (linked-lists, hash tables, etc.). Would it be worth saving development time and using STL, or writing my own implementations? In most situations, I'd just go with STL, but I've recently heard it has a lot of overhead which is unnecessary for video game developement. I'm sure that I could implement my own container classes and get them fairly fast with VTune eventually, but I'm wondering whether the STL is actually fine and I'd just be wasting my time... If any one can offer an opinion I'd be very grateful :) James.

Share this post


Link to post
Share on other sites
It be worth saving development time by using STL. And I don't know where you have heard that stl has alot of overhead and that slt are not suited for game development, because thats just not true.

Lizard

Share this post


Link to post
Share on other sites
Use STL. Always. I do, and it has never hurt me. My bottlenecks are in my own code.

Reason: you posted in "for beginners", so you probably wont beat the compiler writers doing what they do best. I know I wouldn't be able to.

If it was easy to beat the STL, don't you think people would be using such a faster version as the standard?

Share this post


Link to post
Share on other sites
Let's see... you can use existing code that has had a lot of testing and is quite well documented, or you could spend what could be quite a bit of time rolling your own solution which would then require extensive testing to ensure it was behaving as you expected.

Unless you're making your own implementation as a learning experience (it is quite a good excercise if you've got some spare time) always go with the Standard Library implementation; if you find that your resulting program is too slow and profiling reveals the overhead from a Standard Library container is at fault then you might consider trying to write a faster implementation.

Share this post


Link to post
Share on other sites

This topic is 4162 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this