summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorKerem Kat <keremkat@gmail.com>2023-07-29 06:27:11 +0100
committerGitHub <noreply@github.com>2023-07-29 05:27:11 +0000
commit8346d1630b8193eef1ec9dd537b16de74afdc2e8 (patch)
tree666760eeb61b72fac0d01e35b847321a1e77fbae /test/ruby
parent19a3466a1460924058ca16a259601bb753293d43 (diff)
Ruby 3.2 - Speed up rebuilding the loaded feature index and realpath cache (#8023)
* Speed up rebuilding the loaded feature index Rebuilding the loaded feature index slowed down with the bug fix for #17885 in 79a4484a072e9769b603e7b4fbdb15b1d7eccb15. The slowdown was extreme if realpath emulation was used, but even when not emulated, it could be about 10x slower. This adds loaded_features_realpath_map to rb_vm_struct. This is a hidden hash mapping loaded feature paths to realpaths. When rebuilding the loaded feature index, look at this hash to get cached realpath values, and skip calling rb_check_realpath if a cached value is found. Fixes [Bug #19246] * Add a realpath cache to reduce number of syscalls. Number of lstat and stat syscalls for each 'require'd file is doubled, because rb_realpath_internal is called from two places with the same arguments in require_internal; once for checking the realpaths cache, and once in load_iseq_eval when iseq is not found. Introduce rb_realpath_internal_cached function to reuse the realpath_map cache which memoizes rb_realpath_internal function, leading to less syscalls and increased startup performance depending on the cost of the syscalls in a particular environment. --------- Co-authored-by: Jeremy Evans <code@jeremyevans.net>
Diffstat (limited to 'test/ruby')
0 files changed, 0 insertions, 0 deletions