ruby/internal
Jean Boussier c34c4a3cfb Speedup repeated calls to rb_gccct_clear_table
Profiling of `ruby --disable-all -e 1` shows between 5 and 10%
of the time is spent in `_platform_memset`, called from `rb_gccct_clear_table()`,
itself called from `clear_method_cache_by_id_in_class()`.

Which makes sense, during boot we define numerous methods, and after
each we have to invalidate the `gccct`, which is done by zeroing
1023 pointers, so roughtly 8kiB of memory.

By keeping track of whether the table was used since the last clear,
we can save a lot of useless memory writes.

This may also be beneficial when loading user defined code, as it's unlikely
the `gccct` would be dirtied between two `def`.

NB: profiling such a short lived process gives a lot of variance, but
with a very high sampling rate and multiple attempts, `clear_method_cache_by_id_in_class`
is always in the top 2 hotspots.

(cherry picked from commit 14eb0831527b8e1c5bbfef21ecaed14b21103315)
2026-10-30 16:46:28 -07:00
..
2025-12-01 15:19:26 -08:00
2025-11-19 16:05:12 +09:00
…
…
…
2025-12-16 09:51:07 +01:00
…
…
…
…
2025-12-11 23:25:57 +01:00
…
…
2025-12-03 08:14:56 +01:00
…
2025-10-13 15:21:36 -04:00
…
…
…
…
…
…
…
…
…
2025-08-19 10:02:13 -04:00
…
…
2025-11-14 09:37:49 +09:00
…
…