[#118180] [Ruby master Bug#20525] Percent string literal with indentation support — "bradgessler (Brad Gessler) via ruby-core" <ruby-core@...>

Issue #20525 has been reported by bradgessler (Brad Gessler).

8 messages 2024/06/04

[#118243] [Ruby master Feature#20564] Switch default parser to Prism — "kddnewton (Kevin Newton) via ruby-core" <ruby-core@...>

Issue #20564 has been reported by kddnewton (Kevin Newton).

11 messages 2024/06/07

[#118269] [Ruby master Bug#20570] Nokey behavior changed since 3.3. — "ksss (Yuki Kurihara) via ruby-core" <ruby-core@...>

Issue #20570 has been reported by ksss (Yuki Kurihara).

8 messages 2024/06/10

[#118279] [Ruby master Bug#20573] Warning.warn shouldn't be called for disabled warnings — "tenderlovemaking (Aaron Patterson) via ruby-core" <ruby-core@...>

Issue #20573 has been reported by tenderlovemaking (Aaron Patterson).

10 messages 2024/06/10

[#118281] [Ruby master Misc#20574] DevMeeting-2024-07-11 — "mame (Yusuke Endoh) via ruby-core" <ruby-core@...>

Issue #20574 has been reported by mame (Yusuke Endoh).

12 messages 2024/06/11

[#118346] [Ruby master Bug#20586] Some filesystem calls in dir.c are missing error handling and can return incorrect results if interrupted — "ivoanjo (Ivo Anjo) via ruby-core" <ruby-core@...>

Issue #20586 has been reported by ivoanjo (Ivo Anjo).

13 messages 2024/06/19

[#118347] [Ruby master Bug#20587] dir.c calls blocking system calls while holding the GVL — "ivoanjo (Ivo Anjo) via ruby-core" <ruby-core@...>

Issue #20587 has been reported by ivoanjo (Ivo Anjo).

7 messages 2024/06/19

[#118360] [Ruby master Bug#20588] RangeError: integer 132186463059104 too big to convert to 'int' since cdf33ed5f37f9649c482c3ba1d245f0d80ac01ce with YJIT enabled — "yahonda (Yasuo Honda) via ruby-core" <ruby-core@...>

Issue #20588 has been reported by yahonda (Yasuo Honda).

10 messages 2024/06/20

[#118388] [Ruby master Feature#20594] A new String method to append bytes while preserving encoding — "byroot (Jean Boussier) via ruby-core" <ruby-core@...>

SXNzdWUgIzIwNTk0IGhhcyBiZWVuIHJlcG9ydGVkIGJ5IGJ5cm9vdCAoSmVhbiBCb3Vzc2llciku

32 messages 2024/06/25

[ruby-core:118365] [Ruby master Feature#20589] Resize array in `rb_ary_freeze` and use `rb_ary_freeze` internally for arrays

From: "eileencodes (Eileen Uchitelle) via ruby-core" <ruby-core@...>
Date: 2024-06-20 16:42:33 UTC
List: ruby-core #118365
Issue #20589 has been reported by eileencodes (Eileen Uchitelle).

----------------------------------------
Feature #20589: Resize array in `rb_ary_freeze` and use `rb_ary_freeze` internally for arrays
https://bugs.ruby-lang.org/issues/20589

* Author: eileencodes (Eileen Uchitelle)
* Status: Open
----------------------------------------
GitHub PR https://github.com/ruby/ruby/pull/11030

This is a redo of https://github.com/ruby/ruby/pull/2640 and a new issue for the array portion of https://bugs.ruby-lang.org/issues/16291 because both are stale.

This change proposes the following:

1) Call `ary_shrink_capa` from `rb_ary_freeze` to resize arrays before freezing (if they are not embedded, not shared, and not a shared root).
2) Update callers to use `rb_ary_freeze` instead of `rb_obj_freeze` internally in CRuby/
3) Add an assertion to `ary_heap_realloc` that ensures frozen arrays are not being reallocated.\

The orignal issue implemented this for performance reasons, which are still valid. However, additionally this ensures that frozen arrays are not being passed to `ary_heap_realloc` and also ensures the capacity is set with `ARY_SET_CAPA` in `ary_shrink_capa`. Previously, because `ARY_SET_CAPA` was not called, `ary_heap_realloc` would get called after the array was frozen (when that is unnecessary).

Array memsize before and after this change:

Before:

```ruby
$ require 'objspace'
=> false
$ a = (1..5).to_a
=> [1, 2, 3, 4, 5]
$ ObjectSpace.memsize_of(a)
=> 200
$ a.freeze
=> [1, 2, 3, 4, 5]
$ ObjectSpace.memsize_of(a)
=> 200
```

After:

```ruby
$ require 'objspace'
=> false
$ a = (1..5).to_a
=> [1, 2, 3, 4, 5]
$ ObjectSpace.memsize_of(a)
=> 200
$ a.freeze
=> [1, 2, 3, 4, 5]
$ ObjectSpace.memsize_of(a)
=> 80
```



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/

In This Thread

Prev Next