Re: [Plplot-devel] buffer growth

2023-05-04 Thread Jim Dishaw via Plplot-devel
It's been awhile for me (and I apologize).  As the original author of the 
memory buffer implementation I think your approach is the smart way to do it on 
current computers.  When I implemented it originally, I did try an exponential 
approach and it crushed my computer at the time so opted for memory efficiency 
rather than performance.  Memory sizes and virtual memory managers in OSes have 
improved since that time.

If we want to offer support for low memory situations, perhaps an if block that 
selects the memory allocation method, at lines 1644 to 1656 we have

if (_GROW_LINEAR == grow_strategy) {
   lines 1644...1656
}  else {
   an exponential strategy that sets plbuf_buffer_size
}

some where near the beginning we have

static const enum { _GROW_LINEAR, _GROW_EXPONENTIAL } grow_strategy = [some 
define that is set by cmake with a default of _GROW_EXPONENTIAL];

I recommend against using an #ifdef block because it is not a good practice 
with modern compilers.  The compiler should optimize out the conditional 
statement because the grow_strategy variable is defined as const.

Jim

> On May 4, 2023, at 12:35 PM, Phil Rosenberg  wrote:
> 
> 
> Been a while since I've committed anything to the plplot repo, so I wanted to 
> check in before I did anything.
> 
> I just wanted to push a change to buffer growth, so that it grows 
> exponentially rather than linearly (doubles every time it needs to grow). I 
> have some rather large data being plotted by plshades and plplot is doing a 
> lot of reallocs to grow the buffer 128kB at a time.
> 
> Let me know if it's okay to push the commit.
> 
> Phil
> ___
> Plplot-devel mailing list
> Plplot-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/plplot-devel


___
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel


[Plplot-devel] buffer growth

2023-05-04 Thread Phil Rosenberg
Been a while since I've committed anything to the plplot repo, so I wanted
to check in before I did anything.

I just wanted to push a change to buffer growth, so that it grows
exponentially rather than linearly (doubles every time it needs to grow). I
have some rather large data being plotted by plshades and plplot is doing a
lot of reallocs to grow the buffer 128kB at a time.

Let me know if it's okay to push the commit.

Phil
___
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel