summaryrefslogtreecommitdiff
path: root/include/ruby/internal/encoding
diff options
context:
space:
mode:
authorAaron Patterson <tenderlove@ruby-lang.org>2023-09-14 12:48:53 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2023-09-14 16:15:53 -0700
commitf08cac066e3d327f2925607d7a33c8e9738aa4ee (patch)
tree019d41e986d4689eca5dd147e1c7a0b7ed45ea30 /include/ruby/internal/encoding
parent982d6503b9715d8b2fe07ab6b94b08601a34426d (diff)
Don't call malloc with 0
It seems not-uncommon for methods to have no IV, ISE, or ICVARC caches. Calling malloc with 0 will actually allocate something, so if there aren't any caches (`ISEQ_IS_SIZE(body) == 0`), then we can avoid allocating memory by not calling malloc. If there are no caches, then theoretically nobody should be reading from the buffer anyway. This saves about 1MB on Lobsters benchmark.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/8442
Diffstat (limited to 'include/ruby/internal/encoding')
0 files changed, 0 insertions, 0 deletions