Hi, and thanks to the helpful posts i've been reading so far on these forums!
Do heavy processing applications, such as games, suffer significant loss on efficiency if i use standard C++ strings and STL in general?
I'm using some third party code that implements a very useful SDK. The code is very much like C although it is C++. STL has not been used anywhere in the code. I'm wondering if there's a reason for this. I know STL relies heavily on dynamic allocation of objects on the fly. Could this be problematic to the iOS for example?
I like STL very much and find it very useful and would like to use it in my iPhone code. Would that be unwise?
The STL is stonkingly fast, but make sure you take the time to understand its performance characteristics with respect to what you are actually doing.
If you're worried about dynamic object allocation, write yourself a custom small object allocator.
All strings are slow, by the nature of being strings. I have no idea whether the std::string implementation is particularly slow or not, but I would suspect it's actually pretty speedy.
__________________
Visit Mr Jack Games for my blog and more about my games
I like STL very much and find it very useful and would like to use it in my iPhone code. Would that be unwise?
Thanks,
Matti Jokipii,
No Brakes Media
I use it all the time.
Just make sure you are going smart about it like preallocating your containers ahead of time etc ...
Don't use lists or maps if you are dealing with a small number of items ( preallocated vectors will do just fine)
Alternatively you can start using things like intrusive containers (Chapter*10.*Boost.Intrusive)
If you're worried about dynamic object allocation, write yourself a custom small object allocator.
Hopefully i don't deed to but this seems like a very good tip!
Quote:
Originally Posted by Mr Jack
All strings are slow, by the nature of being strings. I have no idea whether the std::string implementation is particularly slow or not, but I would suspect it's actually pretty speedy.
I can live with the usual overhead as long as there are no iPhone specific problems.
Thank you very much for the quick reply and your good advice!
I use it all the time.
Just make sure you are going smart about it like preallocating your containers ahead of time etc ...
I'm glad to hear you're using it with success. This sounds like another good tip! I think i can allocate and request the necessary capacity pretty much at construction or immediately after.
Quote:
Originally Posted by warmi
Don't use lists or maps if you are dealing with a small number of items ( preallocated vectors will do just fine)
Yes, as i said in my reply to Mr Jack, i'm not all that worried about the usual load that we get with STL. I was mostly worried about some unexpected problems that might be specific to the iPhone platform.
That looks interesting! Haven't heard of those before. The technique seems to eliminate a lot of allocations and speed things up in other ways as well. That could be a very useful tool to have in the toolbox.
I use stl on my engine very heavely. Lists, vectors etc.
It runs pretty fast. Worry about batching as much primitives as possible on each GLdraw and you should be fine