personallfy i prefer using a nice 32 bit integer than a pointer to some
memory reference of which i should know size, contents, values & co.
the performance hit of a lookup table is negligible and if i understand
correctly it cleans up the memory after itself so we even have free garbage
collection!
the only drawback i see is less debuggability but i believe that that could
be superseeded by a consistent api
VittorioOn Wed, Jan 20, 2010 at 1:38 PM, Adam Strzelecki wrote:
Regarding performance hit discussions, please remember that optimizations
without
sound reasons are very bad ideas.Yup, I think we all know what Mr. Knuth said about premature optimization.
Personally I believe it is TRUE for 95% applications, however excluding
games/performance sensitive multimedia apps, where some initial choices can
have irreversible impact on performance.I hate this C culture of the programmers wanting to know more than the
compiler does.
The time where compilers weren’t able to proper optimize code is long
gone.Sure you’re right, still I highly doubt compiler will optimize THAT code so
the hash table lookup is as fast as straight pointer. Moreover SDL is
audio/video HW abstraction library aimed for game/multimedia apps, so the
performance IMHO shall be favored over safety.On the other hand seems that SDL_TextureID based implementation won’t
suffer performance hit unless you got really many textures like few
hundreds, since texture hash table keeps 64 linked lists. My concern is that
I actually deal with hundreds of textures in my application.Please first profile your applications with the right set of tools and
then complain with
facts.Agreed.
Regards,
Adam
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
–
Jonathan Swifthttp://www.brainyquote.com/quotes/authors/j/jonathan_swift.html
- “May you live every day of your life.”