POV-Ray : Newsgroups : povray.programming : Improved intersection routine for CSG-Intersection objects : Re: Improved intersection routine for CSG-Intersection objects Server Time
6 Oct 2024 20:19:28 EDT (-0400)
  Re: Improved intersection routine for CSG-Intersection objects  
From: Thorsten Froehlich
Date: 14 Dec 2003 17:51:15
Message: <3fdce963@news.povray.org>
In article <3fdce685@news.povray.org> , Wolfgang Wieser <wwi### [at] gmxde>  
wrote:

> They _are_ less efficient. (Because even temporaries trigger allocatation
> on the heap instead of the fast stack and because the con/destructors
> are called all the time increasing and decreasing reference counters,
> etc.)

Huh???  Nothing happens on the heap at all unless you actually need to copy
dynamically allocated memory.  And on modern compilers an assignment will
rarely cause a copy being made.  Return value optimisation will take care of
almost all cases in modern compilers.  Anyway, this really isn't even
necessary as most STL containers are designed to minimise assignments and
copies to cases where it is really necessary.

> But _not_ for real simple types. For "I quickly need a vector", using
> double v[3] is still faster than anything using operator new or
> applying a fancy con/destructor.

Sorry, but if you need a local variable, who said you should use new???  Of
course if one uses new in a brain-dead manner it is easy to make a program
slow, but it is like using malloc for local variables in C - just something
nobody would do.

    Thorsten

____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.