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:23:17 EDT (-0400)
  Re: Improved intersection routine for CSG-Intersection objects  
From: Warp
Date: 14 Dec 2003 21:33:33
Message: <3fdd1d7d@news.povray.org>
Wolfgang Wieser <wwi### [at] gmxde> wrote:
> So, if you need a local variable of just such a type we're talking about, 
> i.e. a class which simply contains a pointer to an internal class, 
> then the class will be allocated on the stack (okay, fast) and the 
> internal class will be allocated using operator new on the heap. 

  I still not understand that if you want a container of static size
why would be use a dynamic container for that.
  Make a container with static size which does not allocate memory and
there you are.

> All that happens when you call the constructor and initialize your 
> class. For the normal use, this is just what you want because when 
> you pass the class to a function, it is quite fast (just increase 
> reference counter). But if the object is simply a local var you want 
> on the stack, then the overhead is considerably. 

  If the default constructor does nothing, then make it inline with an
empty implementation. The compiler will optimize the constructor call
away. Same goes for the destructor.

> Correct. But if your class behaves that way because you're doing reference 
> counting (see above), then there is little you can do against that. 

  Even if you used a dynamic data container, why would reference counting
kick in (unless you are making functions which take big data containers
by value, which is seldom a good idea)?

-- 
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  - Warp -


Post a reply to this message

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