Re: [PATCH v7 01/20] trace-cmd library: Add support for compression algorithms

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 26 Jan 2022 06:56:13 +0200
Tzvetomir Stoyanov <tz.stoyanov@xxxxxxxxx> wrote:

> > I didn't know about that realloc optimization (check if requested size
> > fits into already allocated memory). In that case, we can use the
> > requested size in both places. But still allocate a page aligned
> > buffer in buffer_extend(), to avoid frequent reallocs (although
> > realloc will be called almost every time).
> >  
> 
> I did some tests, these extra realloc() calls actually cause 7-8% slow
> down on writing compressed trace files. So, I decided to go with the
> other approach - use capacity_read and capacity_write.

Interesting. I'm curious to what exactly that test was.

Anyway, numbers talk, so it's best to save the actual size and capacity
separately then, right? And only call the realloc when you need to grow the
array.

-- Steve



[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux