Actions
Feature #14820
closed[PATCH] ipaddr.rb: use frozen_string_literal
Description
ipaddr.rb: use frozen_string_literal
This reduces GC count by around 10% and provides a tiny speedup.
"make exam" passes, and I've read every single line of ipaddr.rb
so it APPEARS safe. An extra set of eyes would be appreciated.
==> i.rb <==
500_000.times do
IPAddr.new(-"3ffe:505:2::1")
IPAddr.new(-"192.168.2.0/24")
end
p GC.count
$ /usr/bin/time ./ruby i.rb
4058
11.16user 0.33system 0:11.50elapsed 99%CPU (0avgtext+0avgdata 10160maxresident)k
0inputs+0outputs (0major+1390minor)pagefaults 0swaps
$ /usr/bin/time ./ruby -I lib i.rb
3651
10.97user 0.32system 0:11.30elapsed 99%CPU (0avgtext+0avgdata 10196maxresident)k
0inputs+0outputs (0major+1377minor)pagefaults 0swaps
Files
Updated by knu (Akinori MUSHA) almost 6 years ago
- Status changed from Open to Assigned
Thanks for taking the time for this! It looks good to me as well. I'll commit this after testing this out with some of my products that kind of heavily use ipaddr.
Updated by knu (Akinori MUSHA) over 5 years ago
- Status changed from Assigned to Closed
Merged in r66432, thanks!
Actions
Like0
Like0Like0