POV-Ray : Newsgroups : povray.advanced-users : :O I broke it. : Re: :O I broke it. Server Time
6 May 2024 03:53:15 EDT (-0400)
  Re: :O I broke it.  
From: Le Forgeron
Date: 14 Aug 2016 03:35:18
Message: <57b01f36$1@news.povray.org>
Le 13/08/2016 à 23:24, clipka a écrit :
> Also, although it would theoretically be possible to replace the data
> structure with a variable-sized one, any attempts at doing so have so
> far resulted in severely degraded performance.

To avoid reallocation at each new element, you can reserve() some containers like
vector<>.
Until the reserved number of element is reached, no more reallocation. But there is no
signaling of the reservation being full, so after that you're back to the
reallocation.

But vector<> has one constraint: the elements are contiguous. Something that is not
always needed.

The less light-hearted programmers might even replace the default allocator for
something totally different.
But gaining over the traditional malloc is hard, very hard.


Post a reply to this message

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