Commit Graph

11 Commits

Author SHA1 Message Date
S.H 05a3dc1a65
Improve performance Kernel#Float with using Primitive.mandatory_only? method [Feature #18344] (#5133) 2021-11-17 20:26:40 -08:00
Kazuhiro NISHIYAMA 344a824ef9
[DOC] Use URI#read instead of URI.open for better compatibility
- URI.open is available since 2.5.0, but URI#read is available since 1.8.0.
- Fix `open` without `close`.
- ref https://github.com/rurema/doctree/pull/2433
2021-01-12 22:12:02 +09:00
Masataka Pocke Kuwabara 391ee3ee3a Replace `Kernel.#open` with `URI.open` in doc
Because `Kernel.#open` no longer opens URI since Ruby 3.0.
2021-01-08 07:31:27 -08:00
Takashi Kokubun 24fa37d87a
Make Kernel#then, #yield_self, #frozen? builtin (#3283)
* Make Kernel#then, #yield_self, #frozen? builtin

* Fix test_jit
2020-07-03 18:02:43 -07:00
Takashi Kokubun f3a0d7a203
Rewrite Kernel#tap with Ruby (#3281)
* Rewrite Kernel#tap with Ruby

This was good for VM too, but of course my intention is to unblock JIT's inlining of a block over yield
(inlining invokeyield has not been committed though).

* Fix test_settracefunc

About the :tap deletions, the :tap events are actually traced (we already have a TracePoint test for builtin methods),
but it's filtered out by tp.path == "xyzzy" (it became "<internal:kernel>"). We could trace tp.path == "<internal:kernel>"
cases too, but the lineno is impacted by kernel.rb changes and I didn't want to make it fragile for kernel.rb lineno changes.
2020-07-03 09:52:35 -07:00
Takashi Kokubun 946e5cc668
Annotate Kernel#class as inline (#3250)
```
$ benchmark-driver -v --rbenv 'before;after;before --jit;after --jit' benchmark/mjit_class.yml --repeat-count=4
before: ruby 2.8.0dev (2020-06-23T07:09:54Z master 37a2e48d76) [x86_64-linux]
after: ruby 2.8.0dev (2020-06-23T17:29:56Z inline-class 0ff147c007) [x86_64-linux]
before --jit: ruby 2.8.0dev (2020-06-23T07:09:54Z master 37a2e48d76) +JIT [x86_64-linux]
after --jit: ruby 2.8.0dev (2020-06-23T17:29:56Z inline-class 0ff147c007) +JIT [x86_64-linux]
Calculating -------------------------------------
                         before       after  before --jit  after --jit
    mjit_class(self)    39.219M     40.060M       53.502M      69.202M i/s -     40.000M times in 1.019915s 0.998495s 0.747631s 0.578021s
       mjit_class(1)    39.567M     41.242M       52.100M      68.895M i/s -     40.000M times in 1.010935s 0.969885s 0.767749s 0.580591s

Comparison:
                 mjit_class(self)
         after --jit:  69201690.7 i/s
        before --jit:  53502336.4 i/s - 1.29x  slower
               after:  40060289.1 i/s - 1.73x  slower
              before:  39218939.2 i/s - 1.76x  slower

                    mjit_class(1)
         after --jit:  68895358.6 i/s
        before --jit:  52100353.0 i/s - 1.32x  slower
               after:  41241993.6 i/s - 1.67x  slower
              before:  39567314.0 i/s - 1.74x  slower
```
2020-06-23 23:49:03 -07:00
Nobuyoshi Nakada 63aadc237f [Feature #16254] Use `Primitive.func` style 2020-06-19 18:46:55 +09:00
Nobuyoshi Nakada d863f4bccd [Feature #16254] Use `__builtin.func` style 2020-06-19 18:46:55 +09:00
S.H 17083011ee
support builtin for Kernel#Float
# Iteration per second (i/s)

|             |compare-ruby|built-ruby|
|:------------|-----------:|---------:|
|float        |     30.395M|   38.314M|
|             |           -|     1.26x|
|float_true   |      3.833M|   27.322M|
|             |           -|     7.13x|
|float_false  |      4.182M|   24.938M|
|             |           -|     5.96x|
2020-04-22 09:49:13 +09:00
Jeremy Evans 4f7b435c95 Support obj.clone(freeze: true) for freezing clone
This freezes the clone even if the receiver is not frozen.  It
is only for consistency with freeze: false not freezing the clone
even if the receiver is frozen.

Because Object#clone is now partially implemented in Ruby and
not fully implemented in C, freeze: nil must be supported to
provide the default behavior of only freezing the clone if the
receiver is frozen.

This requires modifying delegate and set, to set freeze: nil
instead of freeze: true as the keyword parameter for
initialize_clone.  Those are the two libraries in stdlib that
override initialize_clone.

Implements [Feature #16175]
2020-03-22 09:30:07 -07:00
S.H 290d608637
support builtin for Kernel#clone 2020-03-17 19:37:07 +09:00