From: nobu@... Date: 2015-11-20T23:44:20+00:00 Subject: [ruby-core:71617] [Ruby trunk - Feature #11664] [PATCH] introduce rb_autoload_value to replace rb_autoload Issue #11664 has been updated by Nobuyoshi Nakada. Description updated The new function looks fine to me, but why deprecating `rb_autoload`? We used to append `_str` in many cases, IIRC. ---------------------------------------- Feature #11664: [PATCH] introduce rb_autoload_value to replace rb_autoload https://bugs.ruby-lang.org/issues/11664#change-55017 * Author: Eric Wong * Status: Open * Priority: Normal * Assignee: ---------------------------------------- `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-------------------------------- 0001-introduce-rb_autoload_value-to-replace-rb_autoload.patch (3.89 KB) -- https://bugs.ruby-lang.org/