Issue #14319 has been reported by normalperson (Eric Wong).

----------------------------------------
Feature #14319: [PATCH] zlib: reduce garbage on Zlib::GzipReader#readpartial
https://bugs.ruby-lang.org/issues/14319

* Author: normalperson (Eric Wong)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
```
For garbage-concious users who use the `outbuf' argument of
`readpartial' to supply a destination buffer, this provides
a drastic reduction in garbage when inflating large inputs
in a streaming fashion.

This results in a anonymous RSS reduction in the reader
similar to the reduction in the writer from r61631.

Results using the test script from r61631
<https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61631>

Before:

	writer   7.359999   0.000000   7.359999 (  7.360639)
	writer RssAnon:     4040 kB
	reader   6.346667   0.070000   6.416667 (  7.387654)
	reader RssAnon:    98272 kB

After:

	writer   7.309999   0.000000   7.309999 (  7.310651)
	writer RssAnon:     4048 kB
	reader   6.146666   0.003333   6.149999 (  7.334868)
	reader RssAnon:     4300 kB

* ext/zlib/zlib.c (struct read_raw_arg): new struct
  (gzfile_read_raw_partial): use read_raw_arg
  (gzfile_read_raw_rescue): ditto
  (gzfile_read_raw): accept outbuf, use read_raw_arg
  (gzfile_read_raw_ensure): accept outbuf
  (gzfile_read_header): ditto
  (gzfile_check_footer): ditto
  (gzfile_read_more): ditto
  (gzfile_read_raw_until_zero): adjust for changes
  (gzfile_fill): ditto
  (gzfile_readpartial): ditto
  (gzfile_read_all): ditto
  (gzfile_getc): ditto
  (gzfile_reader_end_run): ditto
  (gzfile_reader_get_unused): ditto
  (rb_gzreader_initialize): ditto
  (gzreader_skip_linebreaks): ditto
  (gzreader_gets): ditto
  (zlib_gunzip_run): ditto
```


---Files--------------------------------
0001-zlib-reduce-garbage-on-Zlib-GzipReader-readpartial.patch (12.8 KB)


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

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>