[ruby-core:87378] [Ruby trunk Feature#14820][Assigned] [PATCH] ipaddr.rb: use frozen_string_literal

From: knu@...
Date: 2018-06-04 05:53:47 UTC
List: ruby-core #87378
Issue #14820 has been updated by knu (Akinori MUSHA).

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.

----------------------------------------
Feature #14820: [PATCH] ipaddr.rb: use frozen_string_literal
https://bugs.ruby-lang.org/issues/14820#change-72365

* Author: normalperson (Eric Wong)
* Status: Assigned
* Priority: Normal
* Assignee: knu (Akinori MUSHA)
* Target version: 
----------------------------------------
```
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--------------------------------
0001-ipaddr.rb-use-frozen_string_literal.patch (1.17 KB)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next