Is the STL efficient enough for mobile devices?

mx2
  • Is the STL efficient enough for mobile devices? mx2

    When it comes to mobile game development on iOS and Android NDK, some developers write their own C++ containers, while others claim that STL is more than adequate for mobile game development (For example, the author of iPhone 3D Programming uses STL rather than Objective-C in his examples. His defense is that STL is no slower than Objective-C).

    Then there are also mobile developers who abandon C++ entirely and develop games entirely (or mostly) in the C language (C89/C90).

    What are the benefits and drawbacks of each approach?

  • Let me tell you one thing first. C++ is faster than Objective-C calls. Objective-C uses message passing systems so it will have some runtime overhead when compared to C++. Just have a look at some of the comparisons here.

    Coming to iOS general "app" development, it makes sense to use Objective-C built-in functions as performance cannot be a much criteria to some extent. But in game development, we need to consider these results.

    When I was working on my previous project (Robokill), we optimized most of the code where ever necessary with plain-C calls (we converted our Objective-C particles class to a C++ class). Or you can even use Objective-C runtime functions for direct C calls.

    Coming to your question, here's my answer: yes, STL is well optimized for its purpose. Even though the implementation code is not much readable, it's interesting to check the implementation once.

    However, we can optimize Objecive-C code to some extent, by pre-caching the function pointers and making calls with the Objective-C runtime.

    Hope this helps!

Tags
c++ android ios optimization
Related questions and answers
  • I've read a couple posts on the subject and it sounds hairy. But I think people are talking about using STL containers for Objective-C objects. I'm using pure C++.

  • I have a good grasp in C++ and C and have also experience developing AAA game using C++. Now, I'm shamelessly thinking to dive into mobile game development either in iOS or Android. Unfortunately, I don't know objective-C and java and neither have courage to learn it. So, As above mentioned reason, Is there any possibility to do mobile development in C++ without using any single statement of JAVA and Objective-C ?

  • around and found this, which claimed that a lot of older developers didn't want to use STL because it wasn't mature enough. Also, older games AFAIK, used C rather than C++, which also doesn't have STL... that. All this seems well and good, except I have one question, why not linked lists rather than arrays? Sure, if you had to make your own linked list class, I would be on board, but in c++ anyway, assuming your using STL, you only need to declare the type as a list, rather than as a vector, and use iterators to loop over it, rather than looping an index. The advantages of using a linked list though

  • So being a primarily c/c++ developer, I've always thought that the only option for mobile game development for me was using iOS, which allows for c/c++ (and minimising objective C). I heard from a friend though, that android has a native development toolkit which allows for c++ code to work on android. Has anyone used this, and if so, how do you find it? I mean, will it "just work" like iOS, or are there more considerations that need to be taken care of due to the wide variety of android devices available?

  • I'm working on mobile platforms as Android, IOS... Many users of Moblox ask us a windows and an OS X version. There is no difficulties to provide these versions, because we are developing on OS X C++ code but we miss global scores and social network part (facebook, twitter). Is there any library to implement these functions on Desktops plaforms ? On mobile platforms, we have many SDK to provide theses functions as OpenFeint, ScoreLoop, Plus+. We have used cocoslive and uploaded scores with libcurl but it's very limited.

  • this is a post detailing my search for the most enjoyable way for a hobbyist game programmer to sweeten his free time with making a game. My requirements: I looked at Flash first, I made a couple... people can play my game once finished). I'd like to have it available on many mobile platforms aswell. (because I love touch input for some reason) I do know the XNA framework pretty well... through APIs. After all, I want to make a game, not an engine. So the question becomes: Is there maybe a cross platform (free or free to develop?) engine available that I could use for 2D development

  • These days, I'm focusing on games development on the iOS. C++ is the lingua franca for games development but seriously, I prefer to code in C programming language, not in C++. So for iOS games development, are C and Objective-C sufficient for creating games?

  • I've been a software developer for 5 years, now, and I am wanting to get into iOS game development. I've played around with the iOS SDK for about 2 years, attending cocoaheads meetings, and I feel I have a good grasp on objective-c, cocoa and even c and c++. I have a game idea, and know that I will use Box2D, but I'm wondering if I should use cocos2D or not. The main reasons are: I may want to do things, graphics wise, that aren't available in cocos2d. If I roll my own game engine, I'll have more control. Of course, the main reason for using an already-existing game engine is the time

  • Which would a game development company prefer, a developer with experience in UDK engine, or a developer with projects made entirely in c++ with a graphics engine like Ogre3D? I think that a coder can demonstrate better his abilities with games made in c++, because it requires a knowledge deeper in many fields. However, currently there is a lot of companies that develop games with UDK. Now I don't know if it's better specialize in a game engine like UDK or not.

Data information