Commit graph

89125 commits

Author SHA1 Message Date
Jean Boussier
26d020cb6e Optimize rb_must_asciicompat
While profiling `strscan`, I noticed `rb_must_asciicompat` was quite
slow, as more than 5% of the benchmark was spent in it: https://share.firefox.dev/49bOcTn

By checking for the common 3 ASCII compatible encoding index first,
we can skip a lot of expensive operations in the happy path.
2024-11-27 14:50:07 +01:00
Kazuhiro NISHIYAMA
43b059b6a3
[DOC] Fix a link and sort links in NEWS.md 2024-11-27 21:03:26 +09:00
Nobuyoshi Nakada
87fc9f4a70
[DOC] Add more links to maintainers 2024-11-27 17:31:56 +09:00
Hiroshi SHIBATA
ac7b63e353 Fixed test condition for specified bundled gems 2024-11-27 16:45:10 +09:00
Hiroshi SHIBATA
26aebdb6d6 Added --env option to mspec for test-bundled-gems 2024-11-27 16:45:10 +09:00
Hiroshi SHIBATA
671e6eb644 Run only specified bundled gems with BUNDLED_GEMS 2024-11-27 16:45:10 +09:00
Hiroshi SHIBATA
9349e98be2 Allow to run 'make test-bundled-gems BUNDLED_GEMS=csv,rexml' for only testing csv and rexml 2024-11-27 16:45:10 +09:00
Hiroshi SHIBATA
24889e44f7 Rename environment name to more descriptive 2024-11-27 16:45:10 +09:00
Alan Wu
c41af37ee6 [ruby/io-console] Read errno before calling rb_io_path()
Possible fix for recent crashes seen on CI.

     [BUG] rb_sys_fail_str(<STDIN>) - errno == 0

rb_io_path() calls rb_obj_dup(), which could call initialize_dup in Ruby
and clobber errno before rb_sys_fail_str() gets to read errno. So
save it out first.

(Using separate statements because order of evaluation in function call
list is unspecified, and order is important here.)

0ba400b5e7
2024-11-27 03:19:39 +00:00
Yusuke Endoh
3face42d8a Revert "Add a temporal debugging code"
This reverts commit 5bd144c1bb.
2024-11-27 11:43:02 +09:00
Nobuyoshi Nakada
42b1eaf234 Mark fiber_entry no-return 2024-11-27 10:47:40 +09:00
Jean Boussier
d5de1a5789 [ruby/strscan] Implement #scan_integer to efficiently parse Integer
(https://github.com/ruby/strscan/pull/115)

Fix: https://github.com/ruby/strscan/issues/113

This allows to directly parse an Integer from a String without needing
to first allocate a sub string.

Notes:

The implementation is limited by design, it's meant as a first step,
only the most straightforward, based 10 integers are supported.

6a3c74b4c8
2024-11-27 09:24:07 +09:00
NAITOH Jun
a041a6c1b5 [ruby/strscan] Add scan and search benchmark
(https://github.com/ruby/strscan/pull/111)

# Why?
To improve the parsing process, I would like to add benchmarks for all
parsing processes.

## scan
- scan_full(regexp, false, true) == StringScanner#check
- scan_full(regexp, false, false) ==  StringScanner#match?

### CRuby

```
$ benchmark-driver benchmark/scan.yaml
Warming up --------------------------------------
          check(reg)    10.558M i/s -     10.848M times in 1.027445s (94.71ns/i)
          check(str)    13.368M i/s -     13.782M times in 1.030978s (74.80ns/i)
         match?(reg)    16.080M i/s -     16.247M times in 1.010340s (62.19ns/i)
         match?(str)    23.336M i/s -     23.501M times in 1.007088s (42.85ns/i)
Calculating -------------------------------------
          check(reg)    11.601M i/s -     31.675M times in 2.730287s (86.20ns/i)
          check(str)    15.217M i/s -     40.104M times in 2.635475s (65.72ns/i)
         match?(reg)    18.781M i/s -     48.241M times in 2.568662s (53.25ns/i)
         match?(str)    29.441M i/s -     70.007M times in 2.377840s (33.97ns/i)

Comparison:
         match?(str):  29441324.5 i/s
         match?(reg):  18780543.7 i/s - 1.57x  slower
          check(str):  15217130.1 i/s - 1.93x  slower
          check(reg):  11601371.2 i/s - 2.54x  slower
```
### JRuby

```
$ benchmark-driver benchmark/scan.yaml
Warming up --------------------------------------
          check(reg)     8.129M i/s -      8.090M times in 0.995222s (123.02ns/i)
          check(str)    16.691M i/s -     16.616M times in 0.995519s (59.91ns/i)
         match?(reg)     8.979M i/s -      9.001M times in 1.002440s (111.37ns/i)
         match?(str)    26.138M i/s -     26.011M times in 0.995150s (38.26ns/i)
Calculating -------------------------------------
          check(reg)    11.808M i/s -     24.387M times in 2.065238s (84.69ns/i)
          check(str)    31.762M i/s -     50.072M times in 1.576495s (31.48ns/i)
         match?(reg)    13.944M i/s -     26.936M times in 1.931719s (71.71ns/i)
         match?(str)    50.872M i/s -     78.414M times in 1.541392s (19.66ns/i)

Comparison:
         match?(str):  50872250.2 i/s
          check(str):  31761544.3 i/s - 1.60x  slower
         match?(reg):  13944219.6 i/s - 3.65x  slower
          check(reg):  11808244.1 i/s - 4.31x  slower
```

## search
- search_full(regexp, false, true) == StringScanner#check_until
- search_full(regexp, false, false) == StringScanner#exist?
```
$ benchmark-driver benchmark/search.yaml
Warming up --------------------------------------
    check_until(reg)     9.338M i/s -      9.456M times in 1.012573s (107.09ns/i)
    check_until(str)    11.385M i/s -     11.979M times in 1.052173s (87.83ns/i)
         exist?(reg)    13.416M i/s -     13.517M times in 1.007532s (74.54ns/i)
         exist?(str)    17.976M i/s -     18.677M times in 1.038981s (55.63ns/i)
Calculating -------------------------------------
    check_until(reg)    10.297M i/s -     28.015M times in 2.720634s (97.11ns/i)
    check_until(str)    12.684M i/s -     34.156M times in 2.692853s (78.84ns/i)
         exist?(reg)    15.184M i/s -     40.249M times in 2.650786s (65.86ns/i)
         exist?(str)    21.426M i/s -     53.928M times in 2.517008s (46.67ns/i)

Comparison:
         exist?(str):  21425527.1 i/s
         exist?(reg):  15183679.9 i/s - 1.41x  slower
    check_until(str):  12684053.7 i/s - 1.69x  slower
    check_until(reg):  10297134.8 i/s - 2.08x  slower
```

### JRuby
```
$ benchmark-driver benchmark/search.yaml
Warming up --------------------------------------
    check_until(reg)     7.646M i/s -      7.649M times in 1.000381s (130.78ns/i)
    check_until(str)    13.075M i/s -     13.010M times in 0.995048s (76.48ns/i)
         exist?(reg)     8.728M i/s -      8.684M times in 0.994921s (114.57ns/i)
         exist?(str)    20.609M i/s -     20.514M times in 0.995399s (48.52ns/i)
Calculating -------------------------------------
    check_until(reg)     9.371M i/s -     22.939M times in 2.447900s (106.71ns/i)
    check_until(str)    22.760M i/s -     39.225M times in 1.723414s (43.94ns/i)
         exist?(reg)    11.758M i/s -     26.185M times in 2.226997s (85.05ns/i)
         exist?(str)    34.564M i/s -     61.827M times in 1.788749s (28.93ns/i)

Comparison:
         exist?(str):  34564306.2 i/s
    check_until(str):  22759878.4 i/s - 1.52x  slower
         exist?(reg):  11757927.4 i/s - 2.94x  slower
    check_until(reg):   9371009.3 i/s - 3.69x  slower
```

81a80a176b
2024-11-27 09:24:06 +09:00
Ellen Marie Dash
092a48de7e [rubygems/rubygems] [SpecFetcher] If candidates include {name}-ruby or ruby-{name}, recommend those.
d7d33172c1
2024-11-26 22:04:26 +00:00
Randy Stauner
8f9b9aecd0
YJIT: Implement opt_reverse insn (#12175) 2024-11-26 16:49:24 -05:00
Matt Valentine-House
33f15ce80d Sync the main branch of ruby/mmtk
The sync script defaults to `master` when analysing which commits to
pick, but the default for new repos now is `main`.
2024-11-27 06:40:15 +09:00
Randy Stauner
1dd40ec18a
Optimize instructions when creating an array just to call include? (#12123)
* Add opt_duparray_send insn to skip the allocation on `#include?`

If the method isn't going to modify the array we don't need to copy it.
This avoids the allocation / array copy for things like `[:a, :b].include?(x)`.

This adds a BOP for include? and tracks redefinition for it on Array.

Co-authored-by: Andrew Novoselac <andrew.novoselac@shopify.com>

* YJIT: Implement opt_duparray_send include_p

Co-authored-by: Andrew Novoselac <andrew.novoselac@shopify.com>

* Update opt_newarray_send to support simple forms of include?(arg)

Similar to opt_duparray_send but for non-static arrays.

* YJIT: Implement opt_newarray_send include_p

---------

Co-authored-by: Andrew Novoselac <andrew.novoselac@shopify.com>
2024-11-26 14:31:08 -05:00
tomoya ishida
c1dcd1d496 [ruby/reline] KeyStroke handles multibyte character
(https://github.com/ruby/reline/pull/713)

5a8da85f2b
2024-11-26 17:58:43 +00:00
tomoya ishida
def684508c [ruby/irb] Fix indentation of xstring literal
(https://github.com/ruby/irb/pull/1038)

Fixes indent calculation of this input
```
if false
p `ls`
end
```

4217a46f5d
2024-11-26 17:50:30 +00:00
Matt Valentine-House
c192d688d1 Add Modular GC and MMTk to NEWS 2024-11-26 11:59:33 +00:00
Jean Boussier
796d315958 Add NEWS.md entry about Hash.new(capacity:)
[Feature #19236]

Ref: https://github.com/ruby/ruby/pull/10357
2024-11-26 11:46:16 +01:00
Raed Rizqie
ffbfec394a [MinGW] - Fix NET_LUID check 2024-11-26 19:36:04 +09:00
Nobuyoshi Nakada
ad28f3a779 Remove Kernel.with_yjit class method 2024-11-26 19:25:25 +09:00
Nobuyoshi Nakada
9508cf86de Clear shared_gc directory 2024-11-26 19:06:21 +09:00
Nobuyoshi Nakada
d057503252 Use extmk.rb to configure shared GC
Since mkmf.rb is for extension libraries after installation, it cannot
work alone in build directory and needs to run from extmk.rb.
2024-11-26 19:06:21 +09:00
Nobuyoshi Nakada
9a5f6a45c6 Fix up gc/extconf_base.rb
- Add flags to appropriate variables.

- Use `append_cflags` to append a flag safely, instead of appending
  blindly.
2024-11-26 19:06:21 +09:00
Nobuyoshi Nakada
c5d31cb96b Shell dependent command should be in Makefile.in
As common.mk is used by nmake.exe, the commands there need to be
accepted also by cmd.exe.
2024-11-26 19:06:21 +09:00
Yusuke Endoh
16d98dc3c1 [ruby/uri] Suppress deprecate warning of test class (retry)
(https://github.com/ruby/uri/pull/140)

A follow-up to bd2e4be9d0

Also, leave a comment that the use of `URI::REGEXP` is intentional

bdf765e44a
2024-11-26 10:02:58 +00:00
Hiroshi SHIBATA
5471f284d2 Skip failing rbs tests with latest HEAD of ruby/json
```
NoMethodError: undefined method 'flush' for an instance of JsonWrite
```
2024-11-26 15:11:05 +09:00
David Rodríguez
2b91a56d40 [rubygems/rubygems] Remove no longer necessary code
9ea1539b08
2024-11-26 15:11:05 +09:00
David Rodríguez
10de74b75b [rubygems/rubygems] Avoid needing a second pass to ignore unlocked gems
When converging locked specifications to select the ones that should be
preserved while resolving, we can avoid having to do a second pass to
ignore the ones that have been explicitly unlocked.

411742703e
2024-11-26 15:11:05 +09:00
David Rodríguez
44ad2e3f38 [rubygems/rubygems] Allow some materialized specs to be missing
As long as some spec in the materialization is complete.

9a673b0bbb
2024-11-26 15:11:05 +09:00
David Rodríguez
36fb7994fe [rubygems/rubygems] Deprecate check parameter to Bundler::SpecSet#for
3041b3d784
2024-11-26 15:11:05 +09:00
David Rodríguez
c76b1ea2a6 [rubygems/rubygems] Keep track of materializations in the original resolve
This gives more flexibility to allow further improvements.

f11a890f5e
2024-11-26 15:11:05 +09:00
David Rodríguez
e15921c694 [rubygems/rubygems] Create LazySpecifications directly with most_specific_locked_platform
So there's no need to pass it around in so many places.

784ab7481b
2024-11-26 15:11:05 +09:00
David Rodríguez
963f98a94f [rubygems/rubygems] Enable Performance/MapCompact cop
0c3a65871a
2024-11-26 15:11:05 +09:00
David Rodríguez
4addaaf4df [rubygems/rubygems] More aggressive Performance/FlatMap cop configuration
d8d68cc00e
2024-11-26 15:11:05 +09:00
David Rodríguez
11e522b913 [rubygems/rubygems] Fix installs of subdependencies of unlocked dependencies to be conservative
When converging specification to pass the set of versions that should be
preserved from the lockfile during resolution, we should make sure all
top level gems are considered, and only exclude those gems themselves
(and not their dependencies) if their locked versions happen to not be
satisfied by an edited Gemfile.

ed2f1b7b88
2024-11-26 15:11:05 +09:00
David Rodríguez
dd400ba630 [rubygems/rubygems] Filter out gems to unlock inside converge_specs
d0f789970f
2024-11-26 15:11:05 +09:00
David Rodríguez
91995d0ad1 [rubygems/rubygems] Remove unnecessary verbose parameter
For consistency with other specs.

a5b2449896
2024-11-26 15:11:05 +09:00
David Rodríguez
d63eeafe69 [rubygems/rubygems] Remove unnecessary let and nesting
c519830d4d
2024-11-26 15:11:05 +09:00
David Rodríguez
6386d49f9e [rubygems/rubygems] Fix development dependencies considered unnecessarily sometimes
When used with `LazySpecification` objects, `SpecSet#for` was
incorrectly considering development dependencies. This did not cause any
issues because all usages of this method with `LazySpecification`'s are
not strict, meaning the pass `check = false` and ignore incomplete
specifications. But it was still doing more work than necessary because
development dependencies were still added to the `deps` array for
processing and then ignored because of not being found in the spec set.

Same when converging path specifications and replacing their dependencies.

6afca8a95f
2024-11-26 15:11:05 +09:00
David Rodríguez
7c93460331 [rubygems/rubygems] Simplify more
a2bb68a29b
2024-11-26 15:11:05 +09:00
David Rodríguez
d6a0e575c9 [rubygems/rubygems] Don't bother sorting if there's a single element
6dc64f9851
2024-11-26 15:11:05 +09:00
David Rodríguez
83ce2351ff [rubygems/rubygems] Remove no longer necessary code
e1caeecdf8
2024-11-26 15:11:05 +09:00
David Rodríguez
631908d9a8 [rubygems/rubygems] Use platform local variable
6a6041d073
2024-11-26 15:11:05 +09:00
David Rodríguez
6916999fed [rubygems/rubygems] This is about locked_platforms
df2c9eb52f
2024-11-26 15:11:05 +09:00
David Rodríguez
7b66aee0b7 [rubygems/rubygems] Set instance variables in consistent order
c382b606bd
2024-11-26 15:11:05 +09:00
Jean Boussier
693a793521 JSON::GeneratorError expose invalid object
Fix: https://github.com/ruby/json/issues/710

Makes it easier to debug why a given tree of objects can't
be dumped as JSON.

Co-Authored-By: Étienne Barrié <etienne.barrie@gmail.com>
2024-11-26 15:11:05 +09:00
Jean Boussier
6805e88935 [ruby/json] Stop using rb_gc_mark_locations
It's using `rb_gc_mark_maybe` under the hood, which isn't what
we need.

e10d0bffcd
2024-11-26 15:11:05 +09:00