diff options
author | Alan Wu <[email protected]> | 2024-10-11 10:22:44 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2024-10-11 10:22:44 -0400 |
commit | 11e7ab79deb5935573d15ba4f33fc41e5c2b7522 (patch) | |
tree | 1cfc9e22733dc2f097db6fda74539feb014fe411 /internal/vm.h | |
parent | 372bb990ac5ea8e348b9187b53d108d06049e6a3 (diff) |
Remove 1 allocation in Enumerable#each_with_index (#11868)
* Remove 1 allocation in Enumerable#each_with_index
Previously, each call to Enumerable#each_with_index allocates 2
objects, one for the counting index, the other an imemo_ifunc passed
to `self.each` as a block.
Use `struct vm_ifunc::data` to hold the counting index directly to
remove 1 allocation.
* [DOC] Brief summary for usages of `struct vm_ifunc`
Notes
Notes:
Merged-By: maximecb <[email protected]>
Diffstat (limited to 'internal/vm.h')
-rw-r--r-- | internal/vm.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/internal/vm.h b/internal/vm.h index 0b6b92c279..c30e26a8b4 100644 --- a/internal/vm.h +++ b/internal/vm.h @@ -77,6 +77,7 @@ VALUE rb_lambda_call(VALUE obj, ID mid, int argc, const VALUE *argv, void rb_check_stack_overflow(void); #define RB_BLOCK_NO_USE_PACKED_ARGS 2 VALUE rb_block_call2(VALUE obj, ID mid, int argc, const VALUE *argv, rb_block_call_func_t bl_proc, VALUE data2, long flags); +struct vm_ifunc *rb_current_ifunc(void); #if USE_YJIT /* vm_exec.c */ |