Issue #6047 has been updated by MartinBosslet (Martin Bosslet).


ko1 (Koichi Sasada) wrote:
> ping. status?
> Do you need helps or comments?

Thanks for your help, to be honest, I haven't tried so far. Can we leave it at 2.0.0 target for now? If I run into problems, I'll ask here!

----------------------------------------
Feature #6047: read_all: Grow buffer exponentially in generic case
https://bugs.ruby-lang.org/issues/6047#change-33374

Author: MartinBosslet (Martin Bosslet)
Status: Assigned
Priority: Normal
Assignee: MartinBosslet (Martin Bosslet)
Category: core
Target version: 2.0.0


In the general case, read_all grows its buffer linearly by just the amount that is currently read from the underlying source. This results in a linear number of reallocs, It might turn out beneficial if the buffer were grown exponentially by multiplying with a constant factor (e.g. 1.5 or 2), thus resulting in only a logarithmic numver of reallocs.

I will provide a patch and benchmarks, but I'm already opening this issue so I won't forget.

See also https://bugs.ruby-lang.org/issues/5353 for more details.


-- 
http://bugs.ruby-lang.org/