Actions
Feature #11664
closed[PATCH] introduce rb_autoload_value to replace rb_autoload
Status:
Closed
Assignee:
-
Target version:
-
Description
rb_autoload_value
may be safer by preventing premature GC. It
can also be more efficient by passing a pre-frozen string that
can be deduped using rb_fstring
. Common autoload callers (e.g.
rubygems, rdoc) already use string literals as the file
argument.
There seems to be no reason to expose rb_autoload_value
to the
public C API since autoload is not performance-critical.
Applications may declare autoloads in Ruby code or via
rb_funcall
; so merely deprecate rb_autoload
without exposing
rb_autoload_value
to new users.
Running: valgrind -v ruby -rrdoc -rubygems -e exit
shows a minor memory reduction (32-bit userspace)
before:
in use at exit: 1,600,621 bytes in 28,819 blocks
total heap usage: 55,786 allocs, 26,967 frees, 6,693,790 bytes allocated
after:
in use at exit: 1,599,778 bytes in 28,789 blocks
total heap usage: 55,739 allocs, 26,950 frees, 6,692,973 bytes allocated
Files
Actions
Like0
Like0Like0Like0Like0Like0Like0Like0