Age | Commit message (Collapse) | Author |
|
|
|
|
|
|
|
(#9532)
This makes the behaviour of IO::Buffer.new(0) and IO::Buffer.new.slice(0, 0) consistent.
Fixes https://bugs.ruby-lang.org/issues/19542 and https://bugs.ruby-lang.org/issues/18805.
|
|
* Don't return early.
* Add missing `mapping` assignment.
* Make debug logs conditional.
|
|
* Avoiding using `Tempfile` which was retaining the file preventing it from unlinking.
|
|
* Restore experimental warnings.
* Documentation and code structure improvements.
* Improved validation of flags, clarified documentation of argument handling.
* Remove inconsistent use of `Example:` and add example to `null?`.
* Expose `IO::Buffer#private?` and add test.
|
|
|
|
|
|
Benchmark:
```
require "benchmark"
puts(Benchmark.measure do
ary = 1_000_000.times.map { IO::Buffer.for("") }
10.times { GC.start(full_mark: false) }
end)
```
Before:
```
14.330119 0.051497 14.381616 ( 14.445106)
```
After:
```
7.481152 0.040166 7.521318 ( 7.535209)
```
|
|
Since IO::Buffer is allocated using TypedData_Make_Struct, it must use
xfree to free the buffer otherwise it will cause more major GC to run.
Example:
```
10.times do
1_000_000.times { IO::Buffer.new(0) }
puts "oldmalloc_increase_bytes: #{GC.stat(:oldmalloc_increase_bytes)}, major_gc_count: #{GC.stat(:major_gc_count)}"
end
```
Before:
```
oldmalloc_increase_bytes: 14904176, major_gc_count: 3
oldmalloc_increase_bytes: 2399424, major_gc_count: 5
oldmalloc_increase_bytes: 5204640, major_gc_count: 6
oldmalloc_increase_bytes: 2199936, major_gc_count: 7
oldmalloc_increase_bytes: 34199936, major_gc_count: 7
oldmalloc_increase_bytes: 24223360, major_gc_count: 8
oldmalloc_increase_bytes: 5967616, major_gc_count: 9
oldmalloc_increase_bytes: 37967616, major_gc_count: 9
oldmalloc_increase_bytes: 9689792, major_gc_count: 10
oldmalloc_increase_bytes: 41689792, major_gc_count: 10
```
After:
```
oldmalloc_increase_bytes: 117392, major_gc_count: 2
oldmalloc_increase_bytes: 26128, major_gc_count: 2
oldmalloc_increase_bytes: 71600, major_gc_count: 2
oldmalloc_increase_bytes: 117072, major_gc_count: 2
oldmalloc_increase_bytes: 17296, major_gc_count: 2
oldmalloc_increase_bytes: 62768, major_gc_count: 2
oldmalloc_increase_bytes: 108240, major_gc_count: 2
oldmalloc_increase_bytes: 153712, major_gc_count: 2
oldmalloc_increase_bytes: 53936, major_gc_count: 2
oldmalloc_increase_bytes: 99408, major_gc_count: 2
```
|
|
`map`. (#9131)
|
|
* Fix `io_buffer_get_string` default length computation.
When an offset bigger than the size is given, the resulting length will be
computed incorrectly. Raise an argument error in this case.
* Validate all arguments.
Notes:
Merged-By: ioquatix <[email protected]>
|
|
Notes:
Merged-By: ioquatix <[email protected]>
|
|
Notes:
Merged-By: ioquatix <[email protected]>
|
|
* Documentation consistency.
* Improve consistency of `pread`/`pwrite` implementation when given length.
* Remove HAVE_PREAD / HAVE_PWRITE - it is no longer optional.
Notes:
Merged-By: ioquatix <[email protected]>
|
|
- Fix IO::Buffer `read`/`write` to use a minimum length.
Notes:
Merged-By: ioquatix <[email protected]>
|
|
Notes:
Merged-By: ioquatix <[email protected]>
|
|
Notes:
Merged-By: ioquatix <[email protected]>
|
|
* Skip test if non-blocking file IO is not supported.
Notes:
Merged-By: ioquatix <[email protected]>
|
|
Notes:
Merged-By: ioquatix <[email protected]>
|
|
`#resize(0)` on an IO::Buffer with internal buffer allocated will
result in calling `realloc(data->base, 0)`. The behavior of `realloc`
with size = 0 is implementation-defined (glibc frees the object
and returns NULL, while BSDs return an inaccessible object). And
thus such usage is deprecated in standard C (upcoming C23 will make it
UB).
To avoid this problem, just `free`s the memory when the new size is zero.
Notes:
Merged-By: ioquatix <[email protected]>
|
|
Notes:
Merged-By: k0kubun <[email protected]>
|
|
|
|
Notes:
Merged-By: ioquatix <[email protected]>
|
|
Notes:
Merged-By: ioquatix <[email protected]>
|
|
`length` is a required argument for `IO::Buffer#read` and
`IO::Buffer#write` methods, and `argc` is already checked with
`rb_check_arity`. Also fix the call-seq of `IO::Buffer#read`.
Notes:
Merged-By: ioquatix <[email protected]>
|
|
Co-authored-by: Samuel Williams <[email protected]>
Notes:
Merged-By: ioquatix <[email protected]>
|
|
`pwrite`. (#7012)
Notes:
Merged-By: ioquatix <[email protected]>
|
|
|
|
* s/Innteger/Integer/
* s/diretory/directory/
* s/Bufer/Buffer/
* s/defalt/default/
* s/covearge/coverage/
Notes:
Merged-By: k0kubun <[email protected]>
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/6721
|
|
Before this change, rdoc shows empty in 'slice' method section
Notes:
Merged: https://github.com/ruby/ruby/pull/6668
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/6634
|
|
Notes:
Merged-By: ioquatix <[email protected]>
|
|
Notes:
Merged-By: ioquatix <[email protected]>
|
|
Notes:
Merged-By: ioquatix <[email protected]>
|
|
Notes:
Merged-By: ioquatix <[email protected]>
|
|
Get rid of the conflict with system-provided small `off_t`.
Notes:
Merged: https://github.com/ruby/ruby/pull/6329
|
|
|
|
|
|
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/6060
|
|
* Use PRIxSIZE instead of "z"
* Fix sign-compare warning
* Suppress unused-but-set-variable warning
|
|
Notes:
Merged-By: ioquatix <[email protected]>
|
|
|
|
Notes:
Merged-By: ioquatix <[email protected]>
|
|
some libc implementations (e.g. wasi-libc) define MREMAP_MAYMOVE, but
don't have mremap itself, so guard the use of mremap by HAVE_MREMAP
Notes:
Merged: https://github.com/ruby/ruby/pull/5401
|
|
|
|
Notes:
Merged-By: ioquatix <[email protected]>
|