delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/06/24/08:23:46

Message-ID: <3590F00D.17B82393@uol.com.br>
Date: Wed, 24 Jun 1998 09:24:45 -0300
From: "Juciê Dias Andrade" <jucie AT uol DOT com DOT br>
MIME-Version: 1.0
To: cwalsh AT nf DOT sympatico DOT ca
CC: djgpp AT delorie DOT com
Subject: Re: Speed of class access....
References: <358fdb1d DOT 0 AT 204 DOT 101 DOT 95 DOT 15>

I dont saw you 3d engine but I know this kind of software manipulates
lots of objects. This is a tipical C++ task.

If you do the job in C then you would be using some flavor of
indirections too, the code would be less readable and possibly
error-prone. Don't do that. To write eficient C++ code you just need
some caution. I will give to you an advice (other guys can tell more):

Unfortunatelly the most expensive operations in C++ are the hide ones:
destruction/construction. It can consume lots and lots of CPU cycles.
Avoid excessive construction/destruction using const and references
wherever you can.

If you do the job the right way then you will see C++ running so fast as
plain C code.

[]s

Obs.: Excuse my English. I'm brasilian.

Colin Walsh escreveu:
> 
> I'm writing a 3D engine using DJGPP and I'm currently at the stage
> where I could use some optimizations, and I've always heard that
> C++ classes were slow in some way, and I happen to be using classes
> for storing my 3D objects (meshes, triangles, texturemaps).
> So, would it be in my best interests just to write some C helper
> functions for managing these objects, or is the speed drop
> negligible?
> 
> Thanks,
> Colin Walsh
> /"Its all fun and games until someone loses an eye...\
> |Then it becomes Australian Rules Football!"         |
> \email - cwalsh AT nf DOT sympatico DOT ca                      /

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019