Use embedded TypedData for Time objects
This drops the total size of a Time object from 86 bytes to 80 bytes.
Running the benchmark benchmark/time_now.yml, this commit improves performance of Time.now by about 30%:
Time.now Branch: 13159405.4 i/s Master: 10036908.7 i/s - 1.31x slower Time.now(in: "+09:00") Branch: 2712172.6 i/s Master: 2138637.9 i/s - 1.27x slower
It also decreases memory usage by about 20%:
ary = 10_000_000.times.map { Time.now } puts `ps -o rss= -p #{$$}`
Branch: 961792 Master: 1196544
Co-Authored-By: Jean Boussier byroot@ruby-lang.org
Use embedded TypedData for Time objects
This drops the total size of a Time object from 86 bytes to 80 bytes.
Running the benchmark benchmark/time_now.yml, this commit improves
performance of Time.now by about 30%:
It also decreases memory usage by about 20%:
Branch: 961792
Master: 1196544
Co-Authored-By: Jean Boussier byroot@ruby-lang.org