Hello everybody

Hello everybody,
It's great to have an active Group for Delphi Devs with easy-to-follow posts/replies.

I have a question regarding Generics Performance: for a specific 3D data structure, if I'm going for maximum speed should I use Generics or do they come with some kind of speed penalty?

I would like to use Generics because they would allow me to specify different additional information per Face / Edge / Vertex by simply defining a record and passing it to a dynamic array that is synchronized with the main 3d data arrays. For different algorithms, in addition to the standard Position, Normal, TexCoord etc., I want to be able to define algorithm-specific structures (that will be quite different between algorithms) and use generics to achieve this.

Does anybody know how much slower should I expect code using Generics to be?  Any better suggestions for the problem stated above (alternatives to using Generics)? 

Thank you,
Claudiu

P.S. Just a personal opinion, I think an "Algorithms" topic would be a really nice addition to this Group's Categories, beside the already existing "Tips'n'Tricks" section.

Comments

  1. Me! ^_^ I'm just restarting because I were long time away from programming when PC were very slow ;). Lars I right Readability and maintinabilty should be priority but this don't limit you to select most important task in terms of amount of resources processing and make it execute as fast as possible. 
     I always try to use good OOP in my projects, but in low level specific graphics subroutines (pixels or vertex processing) I use procedural programming optimizing algorithms first then code. Delphi compiled code is as fast as C++ code, I've been testing it B-) 

    ReplyDelete
  2. A good place for pascal game programming still alive is: http://www.pascalgamedevelopment.com/ :)

    ReplyDelete
  3. Kenneth Cochran The typecast that you have to do in the non-generic list is a no-op (unless you use the as-operator). The compiler just interprets the symbol differently but doesn't generate any code for "TMyClass(MyObject)".

    ReplyDelete

Post a Comment