Age | Commit message (Collapse) | Author |
|
`Integer.sqrt` uses `sqrt(3)` from libm for small values.
This method must return a value less than or equal to the actual integer
square root, but libm's sqrt does not always guarantee that.
This change corrects that by decrementing the result if necessary.
Fixes [Bug #21217]
Notes:
Merged: https://github.com/ruby/ruby/pull/13076
|
|
Not to make preceding paragraphs a code block.
Notes:
Merged: https://github.com/ruby/ruby/pull/12820
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/12496
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/12496
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/12372
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/12229
|
|
Notes:
Merged-By: k0kubun <[email protected]>
|
|
Like as +half+ option in Float#round.
If the body of the preceding list items and the following code block
are indented at the same position, the code block is parsed as a list
continuation.
[Fixes GH-11683]
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/11527
|
|
[Bug #20654]
This commit fixes Integer#ceil and Float#ceil when the number is
negative and ndigits is large such that 10**ndigits is a bignum.
Previously, it would return 0 in such cases. However, this would cause
unexpected behaviour such as:
puts 1.ceil(-5) # => 100000
puts 1.ceil(-10) # => 10000000000
puts 1.ceil(-20) # => 0
This commit changes the last result so that it will return
100000000000000000000.
Notes:
Merged: https://github.com/ruby/ruby/pull/11257
|
|
[Bug #20654]
This commit fixes Integer#floor and Float#floor when the number is
negative and ndigits is large such that 10**ndigits is a bignum.
Previously, it would return 0 in such cases. However, this would cause
unexpected behaviour such as:
puts -1.floor(-5) # => -100000
puts -1.floor(-10) # => -10000000000
puts -1.floor(-20) # => 0
This commit changes the last result so that it will return
-100000000000000000000.
Notes:
Merged: https://github.com/ruby/ruby/pull/11257
|
|
This is slowing down benchmarks on x86, so lets revert it for now.
Notes:
Merged: https://github.com/ruby/ruby/pull/11275
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/11245
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/11245
|
|
|
|
|
|
The granularity is calculated as `10 ** ndigits.abs` rather than
`ndigits.abs * 10`. For example, if `ndigits` is `-2`, it should be
`10 ** 2 == 100` rather than `2 * 10 == 20`.
|
|
|
|
|
|
Speeds up ChunkyPNG.
The interpreter is about 70% faster:
```
before: ruby 3.4.0dev (2024-07-03T15:16:17Z master 786cf9db48) [arm64-darwin23]
after: ruby 3.4.0dev (2024-07-03T15:32:25Z ruby-downto 0b8b744ce2) [arm64-darwin23]
---------- ----------- ---------- ---------- ---------- ------------- ------------
bench before (ms) stddev (%) after (ms) stddev (%) after 1st itr before/after
chunky-png 892.2 0.1 526.3 1.0 1.65 1.70
---------- ----------- ---------- ---------- ---------- ------------- ------------
Legend:
- after 1st itr: ratio of before/after time for the first benchmarking iteration.
- before/after: ratio of before/after time. Higher is better for after. Above 1 represents a speedup.
```
YJIT is 2.5x faster:
```
before: ruby 3.4.0dev (2024-07-03T15:16:17Z master 786cf9db48) +YJIT [arm64-darwin23]
after: ruby 3.4.0dev (2024-07-03T15:32:25Z ruby-downto 0b8b744ce2) +YJIT [arm64-darwin23]
---------- ----------- ---------- ---------- ---------- ------------- ------------
bench before (ms) stddev (%) after (ms) stddev (%) after 1st itr before/after
chunky-png 709.4 0.1 278.8 0.3 2.35 2.54
---------- ----------- ---------- ---------- ---------- ------------- ------------
Legend:
- after 1st itr: ratio of before/after time for the first benchmarking iteration.
- before/after: ratio of before/after time. Higher is better for after. Above 1 represents a speedup.
```
|
|
|
|
Add `zero?` as a related method
|
|
|
|
If a GC runs right during creating a rb_fix_to_s_static, it may cause
the previous ones to become swept by the GC because they have not been
registered by rb_vm_register_global_object.
|
|
Integer.sqrt uses Newton's method.
This pull request reduces the precision which was unnecessarily high in each calculation step.
|
|
This `st_table` is used to both mark and pin classes
defined from the C API. But `vm->mark_object_ary` already
does both much more efficiently.
Currently a Ruby process starts with 252 rooted classes,
which uses `7224B` in an `st_table` or `2016B` in an `RArray`.
So a baseline of 5kB saved, but since `mark_object_ary` is
preallocated with `1024` slots but only use `405` of them,
it's a net `7kB` save.
`vm->mark_object_ary` is also being refactored.
Prior to this changes, `mark_object_ary` was a regular `RArray`, but
since this allows for references to be moved, it was marked a second
time from `rb_vm_mark()` to pin these objects.
This has the detrimental effect of marking these references on every
minors even though it's a mostly append only list.
But using a custom TypedData we can save from having to mark
all the references on minor GC runs.
Addtionally, immediate values are now ignored and not appended
to `vm->mark_object_ary` as it's just wasted space.
|
|
Prefer built-in features over method calls that may be overridden.
|
|
[Feature #16495]
|
|
assert does not print the bug report, only the file and line number of
the assertion that failed. RUBY_ASSERT prints the full bug report, which
makes it much easier to debug.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The line was indented, which caused it to be treated as a code block.
|
|
The documentation was indented one level too deep, which causes RDoc to
generate it all as a code block.
|
|
+==+ does not format properly, so we should use <tt>==</tt> instead.
|
|
In ae0ceafb0c0d05cc80623b525070255e3abb34ef ruby_dtoa was switched to
use malloc instead of xmalloc, which means that consumers should be
using free instead of xfree. Otherwise we will artificially shrink
oldmalloc_increase_bytes.
|
|
When dividing near the precision limit of `double`, use Bignum
division to get rid of rounding errors.
|
|
|
|
|
|
|
|
Notes:
Merged-By: k0kubun <[email protected]>
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/8215
|
|
Notes:
Merged-By: peterzhu2118 <[email protected]>
|
|
The error messages were slightly different due, which causes different
behaviour on 32-bit and 64-bit systems.
Notes:
Merged: https://github.com/ruby/ruby/pull/7872
|
|
NEWOBJ_OF is now our canonical newobj macro. It takes an optional ec
Notes:
Merged: https://github.com/ruby/ruby/pull/7393
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/7459
|
|
|