36 Commits
Author SHA1 Message Date
BurdetteLamar cfd41cbf03 [DOC] Harmonize #-@ methods 2025-12-15 17:28:35 -05:00
Takashi Kokubun 2cd10de330 ZJIT: Prepare for sharing JIT hooks with ZJIT (#14044) 2025-07-30 10:11:10 -07:00
Nobuyoshi Nakada e97dcf53a2 Fix the method name in a comment [ci skip] 2024-11-14 09:24:00 +09:00
Takashi Kokubun 907146973a Add a comment about Integer#downto Enumerator 2024-11-13 12:27:26 -08:00
Takashi KokubunandAaron Patterson 01db456196 Move Array#map to Ruby
Co-Authored-By: Aaron Patterson <tenderlove@ruby-lang.org>
2024-11-13 12:27:26 -08:00
Takashi KokubunandAaron Patterson d57d85548f Move Integer#downto to Ruby
Co-Authored-By: Aaron Patterson <tenderlove@ruby-lang.org>
2024-11-13 12:27:26 -08:00
Takashi Kokubun 0f3723c644 Rewrite Numeric#dup and Numeric#+@ in Ruby (#11933) 2024-10-22 11:01:29 -07:00
Nithin Bekal fe8d7ca853 [DOC] Alias Float#magnitude to abs 2024-10-02 17:32:35 +09:00
Aaron Patterson 2c1655314a Revert moving things to Ruby
This is slowing down benchmarks on x86, so lets revert it for now.
2024-07-29 14:18:11 -07:00
Nobuyoshi Nakada 0fe024d048 Fix the return value of Integer#downto called with a block
As the document states, it should return `self`, not `nil`.
Fix up of f4b313f733.
2024-07-04 12:11:12 +09:00
Aaron Patterson f4b313f733 move Integer#downto to Ruby
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.
```
2024-07-03 10:01:41 -07:00
Nobuyoshi Nakada 3dccb716da Use defined?(yield) and SIZED_ENUMERATOR
Prefer built-in features over method calls that may be overridden.
2024-02-17 23:28:00 +09:00
Takashi Kokubun 27c1dd8634 YJIT: Allow inlining ISEQ calls with a block (#9622)
* YJIT: Allow inlining ISEQ calls with a block

* Leave a TODO comment about u16 inline_block
2024-01-23 19:36:23 +00:00
Takashi Kokubun 5b5ae3d9e0 Rewrite Integer#times in Ruby (#8388) 2023-09-07 10:57:52 -07:00
Burdette Lamar d33555eeae [DOC] RDoc for numeric.rb (#8216) 2023-08-13 21:23:41 -04:00
Šimon Lukašík 2e50c07e23 [DOC] The Document-method hint is needed only in C files
'Document-method' string in C file has a special treatment. In Ruby source file,
however, it is considered to be part of the documentation.

Note Numeric#size was migrated from C to Ruby, in 3208a5df2d
2023-04-10 21:20:42 +09:00
Takashi Kokubun 94da5f7c36 Rename builtin attr :inline to :leaf 2023-03-11 14:25:12 -08:00
Takashi Kokubun 3a02c7818c Change the syntax of Primitive.attr! to Symbol (#7501) 2023-03-10 23:40:57 -08:00
BurdetteLamar 3b239d2480 Remove (newly unneeded) remarks about aliases 2023-02-19 14:26:34 -08:00
Takashi Kokubun 344c16eba4 Avoid using a weird syntax for documentation
Following up 465bd972ec.

If the actual implementation still resides in C, it should be
documented in C just like all other places.
2023-01-30 13:18:19 -08:00
Takashi Kokubun 006682d391 Avoid leaving an uneeded comment
465bd972ec didn't need to leave the obsoleted code.
2023-01-30 13:12:34 -08:00
Kouhei Yanagita 20a85ab611 Fix Integer#ceildiv to respect #coerce (#7118)
Fixes [Bug #19343]
2023-01-22 18:53:02 +09:00
S.H c6f439a6a8 Improve performance some Integer and Float methods [Feature #19085] (#6638)
* Improve some Integer and Float methods

* Using alias and Remove unnecessary code

* Remove commentout code
2022-10-27 09:13:16 -07:00
Kouhei Yanagita 803a072630 Improve performance of Integer#ceildiv
This patch is suggested by nobu.

Benchmark result:

```
require 'benchmark'

n = 10 ** 7

Benchmark.bm do |x|
  x.report("Fixnum/Fixnum") { a, b = 5, 2; n.times { a.ceildiv(b) } }
  x.report("Bignum/Bignum") { a, b = 10**100, 10**99 - 1; n.times { a.ceildiv(b) } }
  x.report("Bignum/Fixnum") { a, b = 10**100, 3; n.times { a.ceildiv(b) } }
end
```

Original:

```
       user     system      total        real
Fixnum/Fixnum  3.340009   0.043029   3.383038 (  3.384022)
Bignum/Bignum  8.229500   0.118543   8.348043 (  8.349574)
Bignum/Fixnum  8.328971   0.097842   8.426813 (  8.426952)
```

Improved:

```
       user     system      total        real
Fixnum/Fixnum  0.699140   0.000961   0.700101 (  0.700199)
Bignum/Bignum  5.076165   0.083160   5.159325 (  5.159360)
Bignum/Fixnum  5.548684   0.115372   5.664056 (  5.666735)
```
2022-08-12 15:57:52 +09:00
Matheus Richard b8f7fc361d Add examples for Integer.try_convert [ci skip] 2021-12-15 02:12:37 +09:00
Matheus Richard b32b755ea2 Fix typo on Integer.try_convert [ci skip] 2021-12-15 02:05:41 +09:00
Nobuyoshi Nakada 454b4da763 [DOC] Integer.try_convert [ci skip] 2021-12-08 17:59:16 +09:00
Burdette Lamar f31b7f0522 Enhanced RDoc for Integer (#5118)
Treats:

#allbits?
#anybits?
#nobits?
#succ
#pred
#chr`
#to_s
#+
#-
2021-11-15 13:52:23 -06:00
S-H-GAMELINKS bdd6d8746f Replace RBOOL macro 2021-09-05 23:01:27 +09:00
Nobuyoshi Nakada 465bd972ec [DOC] Move rdoc of Integer#abs to numeric.rb [ci skip] 2021-08-30 13:33:52 +09:00
S.HandTakashi Kokubun 3208a5df2d Improve perfomance for Integer#size method [Feature #17135] (#3476)
* Improve perfomance for Integer#size method [Feature #17135]

* re-run ci

* Let MJIT frame skip work for Integer#size

Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
2021-06-04 21:57:21 -07:00
Nobuyoshi Nakada 446d000e11 Strip trailing spaces [ci skip] 2021-03-04 11:40:43 +09:00
S.H efd19badf4 Improve performance some Numeric methods [Feature #17632] (#4190) 2021-02-19 11:11:19 -08:00
S.H fad7908a5d Improve performance Float#positive? and Float#negative? [Feature #17614] (#4160) 2021-02-08 20:29:42 -08:00
Takashi Kokubun 9d1475c621 Fix JIT link failures
forgotten in https://github.com/ruby/ruby/pull/4018
2021-01-18 14:52:33 -08:00
S.H daec5f9edc Improve performance some Float methods [Feature #17498] (#4018) 2021-01-01 18:39:07 -08:00