ruby/internal
Alan Wu 11e7ab79de
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`
2024-10-11 10:22:44 -04:00
..
array.h Optimized instruction for Array#freeze 2024-09-05 12:46:02 +02:00
basic_operators.h Introduce a specialize instruction for Array#pack 2024-05-23 12:11:50 -07:00
bignum.h Stop exporting symbols for MJIT 2023-03-06 21:59:23 -08:00
bits.h Make popcount bit-masks stricter 2023-10-05 20:03:54 +09:00
class.h Rename size_pool -> heap 2024-10-03 21:20:09 +01:00
cmdlineopt.h [Feature #19790] Rename BUGREPORT_PATH as CRASH_REPORT 2023-09-25 22:57:28 +09:00
compar.h Introduce BOP_CMP for optimized comparison 2022-12-06 12:37:23 -08:00
compile.h Move the PC regardless of the leaf flag (#8232) 2023-08-16 20:28:33 -07:00
compilers.h internal/*.h: skip doxygen 2021-09-10 20:00:06 +09:00
complex.h internal/*.h: skip doxygen 2021-09-10 20:00:06 +09:00
cont.h Free everything at shutdown 2023-12-07 15:52:35 -05:00
dir.h internal/*.h: skip doxygen 2021-09-10 20:00:06 +09:00
enc.h internal/*.h: skip doxygen 2021-09-10 20:00:06 +09:00
encoding.h Add a hint of `ASCII-8BIT` being `BINARY` 2024-04-18 10:17:26 +02:00
enum.h internal/*.h: skip doxygen 2021-09-10 20:00:06 +09:00
enumerator.h internal/*.h: skip doxygen 2021-09-10 20:00:06 +09:00
error.h `rb_enc_compile_warn` and `rb_enc_compile_warning` are printf format 2024-05-19 22:15:59 +09:00
eval.h [Bug #20342] Consider wrapped load in `main` methods 2024-04-05 01:33:08 +09:00
file.h Revert "reuse open(2) from rb_file_load_ok on POSIX-like system" 2023-02-27 09:24:45 -08:00
fixnum.h `rb_fix_mul_fix` needs internal/bits.h for `MUL_OVERFLOW_FIXNUM_P` 2024-10-08 23:29:49 +09:00
gc.h Rename size_pool -> heap 2024-10-03 21:20:09 +01:00
hash.h Optimized instruction for Hash#freeze 2024-09-05 12:46:02 +02:00
imemo.h Remove 1 allocation in Enumerable#each_with_index (#11868) 2024-10-11 10:22:44 -04:00
inits.h Merge rb_objspace_alloc and Init_heap. 2024-04-04 15:00:57 +01:00
io.h Introduce `rb_io_blocking_region` which takes `struct rb_io` argument. (#11795) 2024-10-05 15:10:12 +13:00
load.h internal/*.h: skip doxygen 2021-09-10 20:00:06 +09:00
loadpath.h internal/*.h: skip doxygen 2021-09-10 20:00:06 +09:00
math.h internal/*.h: skip doxygen 2021-09-10 20:00:06 +09:00
missing.h Free environ when RUBY_FREE_AT_EXIT 2024-01-11 10:09:53 -05:00
numeric.h Faster Integer.sqrt for large bignum 2024-03-18 13:52:27 +09:00
object.h Move rb_class_allocate_instance from gc.c to object.c 2024-02-14 13:43:02 -05:00
parse.h Make default parser enum and define getter/setter 2024-10-02 20:43:40 +09:00
proc.h Stop exporting symbols for MJIT 2023-03-06 21:59:23 -08:00
process.h Put `rb_fork` back into process.c 2023-05-21 23:00:27 +09:00
ractor.h internal/ractor.h: Added 2022-03-30 16:50:46 +09:00
random.h Free everything at shutdown 2023-12-07 15:52:35 -05:00
range.h Implement Struct on VWA 2023-06-05 15:47:16 -04:00
rational.h Don't redefine RB_OBJ_WRITE 2023-01-18 08:49:32 -05:00
re.h Stop allocating unused backref strings at `defined?` 2023-06-27 23:14:10 +09:00
ruby_parser.h Change return value of `gets` function to be `rb_parser_string_t *` instead of `VALUE` 2024-05-04 11:59:10 +09:00
sanitizers.h Fix extra semicolon outside of a function in `NO_SANITIZE` 2024-10-08 23:29:49 +09:00
serial.h internal/*.h: skip doxygen 2021-09-10 20:00:06 +09:00
signal.h Revert "hijack SIGCHLD handler for internal use" 2024-04-04 21:48:14 +09:00
st.h Move internal ST functions to internal/st.h 2023-12-25 10:41:12 -05:00
static_assert.h internal/*.h: skip doxygen 2021-09-10 20:00:06 +09:00
string.h Don't export unnecessary string functions 2024-09-16 14:38:49 -04:00
struct.h Remove unused references to the transient heap 2023-07-13 14:48:14 -04:00
symbol.h Free everything at shutdown 2023-12-07 15:52:35 -05:00
thread.h Ensure fiber scheduler is woken up when close interrupts read 2024-09-17 10:11:44 +10:00
time.h internal/*.h: skip doxygen 2021-09-10 20:00:06 +09:00
transcode.h Free everything at shutdown 2023-12-07 15:52:35 -05:00
util.h internal/*.h: skip doxygen 2021-09-10 20:00:06 +09:00
variable.h Fix compaction for generic ivars 2023-11-24 13:29:04 -05:00
vm.h Remove 1 allocation in Enumerable#each_with_index (#11868) 2024-10-11 10:22:44 -04:00
warnings.h internal/*.h: skip doxygen 2021-09-10 20:00:06 +09:00