What should I use? my containers or STL?

Started by
25 comments, last by ThunderMusic_80 20 years, 6 months ago
Hi, The subject almost says it all. What should I use between my own template containers and STL if I want my project to be compilable on many OS? Because I want to build an Engine (with some friends of mine) and I was wondering what would be the best for portability and performance. Are STL performant enough so I could use them in games or are they too slow? Thanks ThunderMusic
ThunderMusic
Advertisement
STL all the way.
They are both performant and cross-platform?

thanks

ThunderMusic
ThunderMusic
Yes, of course.

The world would be a better place if people would use standard libraries more often instead of wasting their own time and risking unknown bugs by implementing the same features themselves. It's okay when just for learning purposes, but if the project is at all serious...

[edited by - merlin9x9 on October 21, 2003 12:12:10 PM]
How many platforms are you targeting? I use them on Unix and Windows (GNU g++ and Borland C++ Builder). Asking if they are fast enough is like asking if a piece of string is long enough. It depends on what you want to use it for. Write your code first, then profile it, and only after you have determined where the bottlenecks are, begin optimizing it. I'm guessing that STL vs. homegrown containers will be a performance non-issue in a game engine.


--
Dave Mikesell Software & Consulting

[edited by - dmikesell on October 21, 2003 12:05:10 PM]
I would have to agree.

Stick with STL.

If you are going to have more than 1 developer working on your source code, it would make more sense to use a library that has been around for a while and that people already know how to use.

Plus, you also get the additional use of using such things as BOOST to enhance your template library.

Why use home grown,generic templates when you have a standard already built for you.

Personally, it is a waste of time to work on your own containers, unless you are doing it to understand the concepts behind the containers.

Alek
quote:
It depends on what you want to use it for. Write your code first, then profile it, and only after you have determined where the bottlenecks are, begin optimizing it. I''m guessing that STL vs. homegrown containers will be a performance non-issue in a game engine.


Correct me if I''m wrong, but the STL is very fast. It was made by a bunch of really smart dudes, and If you can implement your own containers or whatever you need and acutally have them faster than the STL, then you should have no problem getting a job just about anywhere (programming I mean).
In other words, dont try to make your own in the hopes that it will be faster, unless you know an AWEFUL lot about the subject. In which case you probably wouldnt have asked this question...
It''s fast in terms of a large project that needs flexibility, stability, and readability, but in a tight loop, the STL rarely performs better than well optimized C-style code.
quote:Original post by AndreTheGiant
Correct me if I''m wrong, but the STL is very fast. It was made by a bunch of really smart dudes, and If you can implement your own containers or whatever you need and acutally have them faster than the STL, then you should have no problem getting a job just about anywhere (programming I mean).
In other words, dont try to make your own in the hopes that it will be faster, unless you know an AWEFUL lot about the subject. In which case you probably wouldnt have asked this question...

Well, there''s always the chance that your needs are more specific than the STL is written for. The STL is good, but if your needs are very minimalistic with respect to the properties you need, or if your optimisation needs are very specific (the STL containers are presumably written to be efficient in terms of both execution time and storage space), I should think there''s a chance that your solution may be closer to optimal simply because your design goals are different from those of the STL designers.

Of course, for most applications, the STL should work admirably, and alternative solutions should only be researched if STL efficiency is found to be a bottleneck.
I target everything that can run a game, so win32, macOS and Unix (linux).

I''ll stick with the stl, but what about the odd names? I mean, vector for a dynamic array, I would have searched a long time to find it alone... Is there something like a tree structure in STL?

thanks

ThunderMusic
ThunderMusic

This topic is closed to new replies.

Advertisement