Compact new_set instead of set in Set#^
Follow-up to 388ea3c3cf (#18058, [Bug #22210]). Set#^ removes elements from the result set, but the compaction call targets the receiver. Compact the result set after applying the symmetric difference.
For Set.new(0..1000) ^ (0..999).to_a, ObjectSpace.memsize_of reports...
Set.new(0..1000) ^ (0..999).to_a
ObjectSpace.memsize_of
Do not drop line before separator match in middle of char
rb_str_enumerate_lines searches for the separator byte-wise. When a match turned out to start in the middle of a character, it moved the start of the current line past that character instead of only resuming...
ibf: dump method labels as their name symbol
Saves a fstring table lookup and shrink to_binary size a little bit.
to_binary
Store packed iseq node ids without a header, inline when short
Packed iseqs (nearly all of them) only used insns_info to hold a {size = 0, node_ids_size} header followed by the node id varint stream.
{size = 0, node_ids_size}
The header is now replaced by a varint length prefix on the malloc'd...
String#initialize: use Primitive.unset!
Introduce Primitive.unset! for omitted optional builtin parameters
Builtin methods written in Ruby often need to handle optional parameters like C methods do, meaning differenciate between an argument not being passed, and the default value being passed....
Refactor the rounding in big2dbl()
Refactoring only, no change in the result: make mask and bit once and clear the low bits in every case, instead of in the round-up case plus a separate line.
Co-Authored-By: Claude Sonnet 5.5 noreply@anthropic.com
Fix double rounding in Integer#to_f on x87
0x100000000000017ff.to_f should be 0x10000000000001000p+0 instead of 0x10000000000002000p+0 on x87.
d = dl + BIGRAD*d in big2dbl() rounds twice on x87 (the default of gcc -m32): the exact sum of more than 64 bits is rounded to the 64 bit...
d = dl + BIGRAD*d
ibf_load: reuse dummy frames
It's not a lot, but it's wasteful to create and push a dummy frame for each iseq. Given all iseqs share the same path, we can build only one and reuse it.
ibf: dump the coderange of strings and symbols
Since they will be interned, the coderange will have to be recomputed anyway, so we might as well save that step.
View all revisions | View revisions
Also available in: Atom