1383 Commits

Author SHA1 Message Date
git
c913a635d7 Update default gems list at b9782ab8932f9fb6a24a0522c579ca [ci skip] 2025-07-08 07:26:18 +00:00
git
4d7e622064 Update bundled gems list as of 2025-07-06 2025-07-06 07:04:24 +00:00
git
4d6fac3e95 Update bundled gems list as of 2025-07-03 2025-07-04 07:05:42 +00:00
git
ce6e612095 Update bundled gems list as of 2025-07-01 2025-07-01 07:06:23 +00:00
Hiroshi SHIBATA
8bba087ae5 Added entry open_timeout feature of Socket.tcp to NEWS.md 2025-06-27 11:15:17 +09:00
git
cf6b4e7278 Update default gems list at 62aa4a6010c293ea58cfec59f316f0 [ci skip] 2025-06-24 09:33:51 +00:00
git
8ce6546371 Update bundled gems list as of 2025-06-20 2025-06-20 04:52:53 +00:00
Nobuyoshi Nakada
bfb14c2be9
[DOC] Add the link to [Feature #21219] 2025-06-19 11:33:30 +09:00
Nobuyoshi Nakada
5a19914030
[DOC] Fix indentation
RDoc markdown parser requires exact 4 spaces or tab as indentation.
Also the first nested bullet list must be separated from the enclosing
bullet list item by a blank line.
2025-06-19 11:17:58 +09:00
git
a4c4a347b7 Update default gems list at c2d5d2969a501b9db93ed66db9017a [ci skip] 2025-06-19 01:54:15 +00:00
git
13a2b9fa2d Update bundled gems list as of 2025-06-18 2025-06-18 07:06:15 +00:00
ydah
ef66aef791 Fix typo in NEWS.md 2025-06-15 22:34:19 +09:00
Joshua Young
a21acaee6d Follow-ups to #13555 2025-06-10 12:25:32 +02:00
Nobuyoshi Nakada
f4135feafc [Feature #21219] Selective inspect of instance variables
Make Kernel#inspect ask which instance variables should be dumped by
the result of `#instance_variables_to_inspect`.

Co-Authored-By: Jean Boussier <byroot@ruby-lang.org>
2025-06-09 09:25:37 +02:00
git
e093c3145a Update default gems list at 9f00044d0fe2d0c8c998da8e1627e6 [ci skip] 2025-06-06 02:38:59 +00:00
git
256440a827 Update bundled gems list as of 2025-06-05 2025-06-05 07:05:29 +00:00
git
3fd2d54a0a Update bundled gems list as of 2025-06-01 2025-06-01 07:03:33 +00:00
tomoya ishida
49f35c917b
Bump bundled bigdecimal to 3.2.1 (#13482) 2025-05-31 09:31:17 +00:00
Nobuyoshi Nakada
9dc9d5f5a6
[DOC] Fix indentation
RDoc markdown parser requires exact 4 spaces or tab as indentation.
Also the first nested bullet list must be separated from the enclosing
bullet list item by a blank line.
2025-05-31 16:49:21 +09:00
Koichi Sasada
57d10c6e80 NEWS entries for Ractor::Port 2025-05-31 13:06:22 +09:00
git
e577edb12e Update bundled gems list as of 2025-05-30 2025-05-30 19:14:14 +00:00
git
2295384a5a Update default gems list at 874469e7cefc6a08afb8fb30556786 [ci skip] 2025-05-26 02:47:26 +00:00
Samuel Williams
73c9d6ccaa
Allow IO#close to interrupt IO operations on fibers using fiber_interrupt hook. (#12839) 2025-05-23 14:55:05 +09:00
git
df66d2befb Update bundled gems list as of 2025-05-21 2025-05-21 07:03:43 +00:00
git
bfe89c7a90 Update bundled gems list as of 2025-05-19 2025-05-20 07:03:43 +00:00
Jeremy Evans
c52f4eea56 Remove SortedSet autoload and set/sorted_set
Implements [Feature #21287]
2025-05-20 13:34:31 +09:00
Nobuyoshi Nakada
93ce95d46c
[DOC] Fix indentation
RDoc markdown parser requires exact 4 spaces or tab as indentation.
2025-05-19 22:49:22 +09:00
Nobuyoshi Nakada
22c1201bba
[DOC] Fold long lines 2025-05-19 22:47:07 +09:00
Kazuhiro NISHIYAMA
40c957ba21
Fix a typo and capitalize a character 2025-05-19 13:27:50 +09:00
git
b2ab1b0409 Update bundled gems list as of 2025-05-15 2025-05-15 15:21:46 +00:00
git
ee7dcef0f6 Update default gems list at 57f8dde0f2228dbc67503403d740a7 [ci skip] 2025-05-14 17:11:57 +00:00
git
f82dce148c Update default gems list at 9db0704e67c8af3b47429e28e1da5e [ci skip] 2025-05-13 18:10:46 +00:00
Samuel Williams
1e2a67e1b0 Fix typo in NEWS.md. 2025-05-13 23:16:21 +09:00
Kazuhiro NISHIYAMA
7517d7629d
[DOC] Fix a link and sort links in NEWS.md 2025-05-13 19:28:56 +09:00
Samuel Williams
425fa0aeb5
Make waiting_fd behaviour per-IO. (#13127)
- `rb_thread_fd_close` is deprecated and now a no-op.
- IO operations (including close) no longer take a vm-wide lock.
2025-05-13 19:02:03 +09:00
git
c40557099d Update default gems list at cd7495a1d0e003360c96bb9746c1a8 [ci skip] 2025-05-13 05:13:24 +00:00
git
03a7f1ff08 Update default gems list at 957473d87fc7741c8d36caed8f05db [ci skip] 2025-05-12 16:22:47 +00:00
git
3c37d6ffcf Update bundled gems list as of 2025-05-09 2025-05-10 06:59:40 +00:00
git
87b621bd5b Update default gems list at 58c008e68f31a8056df508cc46e17c [ci skip] 2025-05-09 22:13:51 +00:00
Hiroshi SHIBATA
4ef324c7c1
Added https://bugs.ruby-lang.org/issues/21258 to NEWS.md 2025-05-09 15:37:01 +09:00
git
dcd0a35c6d Update default gems list at d3c472781dec4fe415203fbb898d8b [ci skip] 2025-05-09 05:28:22 +00:00
git
d2a0e98c78 Update default gems list at 0f066269150375982712bd4a918438 [ci skip] 2025-05-02 01:40:59 +00:00
git
17e63f90ca Update default gems list at b63c4d14f2a9f5455268b6ac6fb1b4 [ci skip] 2025-05-01 16:35:17 +00:00
git
142998fdaa Update bundled gems list as of 2025-04-30 2025-04-30 07:04:02 +00:00
git
d046c0a471 Update default gems list at 6e7825316ed572e56f6e1baabe63ef [ci skip] 2025-04-30 06:13:46 +00:00
Jeremy Evans
e4f85bfc31 Implement Set as a core class
Set has been an autoloaded standard library since Ruby 3.2.
The standard library Set is less efficient than it could be, as it
uses Hash for storage, which stores unnecessary values for each key.

Implementation details:

* Core Set uses a modified version of `st_table`, named `set_table`.
  than `s/st_/set_/`, the main difference is that the stored records
  do not have values, making them 1/3 smaller. `st_table_entry` stores
  `hash`, `key`, and `record` (value), while `set_table_entry` only
  stores `hash` and `key`.  This results in large sets using ~33% less
  memory compared to stdlib Set.  For small sets, core Set uses 12% more
  memory (160 byte object slot and 64 malloc bytes, while stdlib set
  uses 40 for Set and 160 for Hash).  More memory is used because
  the set_table is embedded and 72 bytes in the object slot are
  currently wasted. Hopefully we can make this more efficient and have
  it stored in an 80 byte object slot in the future.

* All methods are implemented as cfuncs, except the pretty_print
  methods, which were moved to `lib/pp.rb` (which is where the
  pretty_print methods for other core classes are defined).  As is
  typical for core classes, internal calls call C functions and
  not Ruby methods.  For example, to check if something is a Set,
  `rb_obj_is_kind_of` is used, instead of calling `is_a?(Set)` on the
  related object.

* Almost all methods use the same algorithm that the pure-Ruby
  implementation used.  The exception is when calling `Set#divide` with a
  block with 2-arity.  The pure-Ruby method used tsort to implement this.
  I developed an algorithm that only allocates a single intermediate
  hash and does not need tsort.

* The `flatten_merge` protected method is no longer necessary, so it
  is not implemented (it could be).

* Similar to Hash/Array, subclasses of Set are no longer reflected in
  `inspect` output.

* RDoc from stdlib Set was moved to core Set, with minor updates.

This includes a comprehensive benchmark suite for all public Set
methods.  As you would expect, the native version is faster in the
vast majority of cases, and multiple times faster in many cases.
There are a few cases where it is significantly slower:

* Set.new with no arguments (~1.6x)
* Set#compare_by_identity for small sets (~1.3x)
* Set#clone for small sets (~1.5x)
* Set#dup for small sets (~1.7x)

These are slower as Set does not currently use the AR table
optimization that Hash does, so a new set_table is initialized for
each call.  I'm not sure it's worth the complexity to have an AR
table-like optimization for small sets (for hashes it makes sense,
as small hashes are used everywhere in Ruby).

The rbs and repl_type_completor bundled gems will need updates to
support core Set.  The pull request marks them as allowed failures.

This passes all set tests with no changes.  The following specs
needed modification:

* Modifying frozen set error message (changed for the better)
* `Set#divide` when passed a 2-arity block no longer yields the same
  object as both the first and second argument (this seems like an issue
  with the previous implementation).
* Set-like objects that override `is_a?` such that `is_a?(Set)` return
  `true` are no longer treated as Set instances.
* `Set.allocate.hash` is no longer the same as `nil.hash`
* `Set#join` no longer calls `Set#to_a` (it calls the underlying C
   function).
* `Set#flatten_merge` protected method is not implemented.

Previously, `set.rb` added a `SortedSet` autoload, which loads
`set/sorted_set.rb`.  This replaces the `Set` autoload in `prelude.rb`
with a `SortedSet` autoload, but I recommend removing it and
`set/sorted_set.rb`.

This moves `test/set/test_set.rb` to `test/ruby/test_set.rb`,
reflecting that switch to a core class.  This does not move the spec
files, as I'm not sure how they should be handled.

Internally, this uses the st_* types and functions as much as
possible, and only adds set_* types and functions as needed.
The underlying set_table implementation is stored in st.c, but
there is no public C-API for it, nor is there one planned, in
order to keep the ability to change the internals going forward.

For internal uses of st_table with Qtrue values, those can
probably be replaced with set_table.  To do that, include
internal/set_table.h.  To handle symbol visibility (rb_ prefix),
internal/set_table.h uses the same macro approach that
include/ruby/st.h uses.

The Set class (rb_cSet) and all methods are defined in set.c.
There isn't currently a C-API for the Set class, though C-API
functions can be added as needed going forward.

Implements [Feature #21216]

Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
Co-authored-by: Oliver Nutter <mrnoname1000@riseup.net>
2025-04-26 10:31:11 +09:00
git
24c838f92e Update bundled gems list as of 2025-04-25 2025-04-25 07:03:06 +00:00
git
daef56cfa3 Update default gems list at 6f336d1b154e608d5200bd8de48473 [ci skip] 2025-04-25 02:17:29 +00:00
git
7af5a632f4 Update bundled gems list as of 2025-04-24 2025-04-24 07:03:05 +00:00
git
888820c581 Update bundled gems list as of 1980-01-02 2025-04-22 07:03:05 +00:00