l4-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C++


From: Arne Babenhauserheide
Subject: Re: C++
Date: Thu, 24 Sep 2009 13:49:48 +0200
User-agent: KMail/1.12.1 (Linux/2.6.30-gentoo-r5; KDE/4.3.1; x86_64; ; )

Am Donnerstag, 24. September 2009 12:52:13 schrieb Sam Mason:
> I've written application code that was 30 times faster when it was
> written in C (i.e. lots of arrays) vs. C++ (with a nice easy to
> understand class hierarchy).

That's the same optimization people in the gaming industry use(-d?) for tiles: 
just go for simple arrays - your program knows where to break them, and they 
save you the precious extra processing time and memory you need for all those 
other nifty effects :) 

But then that isn't about C++ vs. C, it's about how to most efficiently 
represent your data in memory. And for many access patterns an array is simply 
the fastest way. 

And if you need massive performance, you should naturally forgo readability. 

But these arrays are damn error prone and hard to unerstand. 

Many things don't need as much performance, though. I wouldn't bother to write 
a level-reader for a game in C, even though I might have to use C for graphics 
code. Reason: The level is read once and is disk-bound. Graphics are needed 
all the time (essentially a while loop). 

Best wishes, 
Arne

--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- 
   - singing a part of the history of free software -
              http://infinite-hands.draketo.de

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]