diff options
author | Kevin Newton <kddnewton@gmail.com> | 2022-04-05 16:37:00 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-05 16:37:00 -0400 |
commit | 8ee4a82e8cfe6f39abeb60013447bdd2a3a3c61f (patch) | |
tree | 98de69b8cf48b6af86e980897c4563514280af0f /GPL | |
parent | 5571ca3aa2029789e968fe8b13e176fa98fcea36 (diff) | |
download | ruby-8ee4a82e8cfe6f39abeb60013447bdd2a3a3c61f.tar.gz |
RubyVM.stat constant cache metrics (#5766)
Before the new constant cache behavior, caches were invalidated by a
single global variable. You could inspect the value of this variable
with RubyVM.stat(:global_constant_state). This was mostly useful to
verify the behavior of the VM or to test constant loading like in Rails.
With the new constant cache behavior, we introduced
RubyVM.stat(:constant_cache) which returned a hash with symbol keys and
integer values that represented the number of live constant caches
associated with the given symbol. Additionally, we removed the old
RubyVM.stat(:global_constant_state).
This was proven to be not very useful, so it doesn't help you diagnose
constant loading issues. So, instead we added the global constant state
back into the RubyVM output. However, that number can be misleading as
now when you invalidate something like `Foo::Bar::Baz` you're actually
invalidating 3 different lists of inline caches.
This commit attempts to get the best of both worlds. We remove
RubyVM.stat(:global_constant_state) like we did originally, as it
doesn't have the same semantic meaning and it could be confusing going
forward. Instead we add RubyVM.stat(:constant_cache_invalidations) and
RubyVM.stat(:constant_cache_misses). These two metrics should provide
enough information to diagnose any constant loading issues, as well as
provide a replacement for the old global constant state.
Diffstat (limited to 'GPL')
0 files changed, 0 insertions, 0 deletions