diff options
| author | Jean Boussier <jean.boussier@gmail.com> | 2024-12-30 11:10:51 +0100 |
|---|---|---|
| committer | Jean Boussier <jean.boussier@gmail.com> | 2025-01-05 17:04:54 +0100 |
| commit | 22e9fa81ca27243922ec9a32fdd96065becb35f9 (patch) | |
| tree | 8554c9c986dbb9c14a483c6495cc65da84b676a7 /test/ruby | |
| parent | 37361d87a6903c16d3e0662ae6a7e285f3ede68b (diff) | |
gc/default/default.c: don't call `malloc_usable_size` when hint is present
Depending on the allocator, `malloc_usable_size` may be very cheap or quite
expensive. On `macOS` for instance, it's about as expensive as `malloc`.
In many case we call `objspace_malloc_size` with as size we initially
requested as `hint`. The real usable size may be a few bytes bigger,
but since we only use that data to feed GC heuristics, I don't think
it's very important to be perfectly accurate.
It would make sense to call `malloc_usable_size` after growing a String
or Array to use the extra capacity, but here we don't do that, so
the call isn't worth its cost.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/12490
Diffstat (limited to 'test/ruby')
0 files changed, 0 insertions, 0 deletions
