From: Aaron Patterson Date: 2011-07-06T07:19:11+09:00 Subject: [ruby-core:37815] Re: [Ruby 1.9 - Bug #4962][Open] come back gem_prelude! --QKdGvSO+nmPlgiQ/ Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jul 06, 2011 at 07:01:37AM +0900, Luis Lavena wrote: > On Tue, Jul 5, 2011 at 6:56 PM, Aaron Patterson > wrote: > > > > We can also help rbconfig go on a diet. =A0I know it's not enough, but > > this eliminated ~400 object allocations on my machine. =A0(what is the > > MAKEFILE_CONFIG for anyway?) >=20 > Is used by mkmf, which raises another round of questions: why is not > using RbConfig::CONFIG directly? I assume it's so that if someone mutates the hash, it doesn't impact the RbConfig::CONFIG hash. Though, if that's the case, why doesn't mkmf.rb just dup the hash rather than relying on rbconfig. Maybe this patch is more appropriate: diff --git a/lib/mkmf.rb b/lib/mkmf.rb index 9b0b8c7..efaa603 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -6,7 +6,7 @@ require 'rbconfig' require 'fileutils' require 'shellwords' =20 -CONFIG =3D RbConfig::MAKEFILE_CONFIG +CONFIG =3D RbConfig.makefile_config ORIG_LIBPATH =3D ENV['LIB'] =20 C_EXT =3D %w[c m] diff --git a/template/fake.rb.in b/template/fake.rb.in index 7bfa0ae..b487a79 100755 --- a/template/fake.rb.in +++ b/template/fake.rb.in @@ -24,7 +24,7 @@ end =20 $:.unshift(File.expand_path("..", __FILE__)) posthook =3D proc do - mkconfig =3D RbConfig::MAKEFILE_CONFIG + mkconfig =3D RbConfig.makefile_config extout =3D File.expand_path(mkconfig["EXTOUT"], mkconfig["builddir"]) $arch_hdrdir =3D "#{extout}/include/$(arch)" $ruby =3D baseruby @@ -33,7 +33,7 @@ end prehook =3D proc do |extmk| unless extmk config =3D RbConfig::CONFIG - mkconfig =3D RbConfig::MAKEFILE_CONFIG + mkconfig =3D RbConfig.makefile_config builddir =3D File.expand_path(File.dirname(__FILE__)) mkconfig["top_srcdir"] =3D $top_srcdir =3D File.expand_path("@top_srcd= ir@", builddir) mkconfig["rubyhdrdir"] =3D "$(top_srcdir)/include" diff --git a/tool/compile_prelude.rb b/tool/compile_prelude.rb index 6ad9fce..0674754 100755 --- a/tool/compile_prelude.rb +++ b/tool/compile_prelude.rb @@ -49,9 +49,9 @@ class Prelude key =3D $1 unless @mkconf require './rbconfig' - @mkconf =3D RbConfig::MAKEFILE_CONFIG.merge('prefix'=3D>'#{TMP_R= UBY_PREFIX}') + @mkconf =3D RbConfig.makefile_config.merge('prefix'=3D>'#{TMP_RU= BY_PREFIX}') end - if RbConfig::MAKEFILE_CONFIG.has_key? key + @mkconf.has_key? key val =3D RbConfig.expand("$(#{key})", @mkconf) @need_ruby_prefix ||=3D /\A\#\{TMP_RUBY_PREFIX\}/ =3D~ val c_esc(val) diff --git a/tool/mkconfig.rb b/tool/mkconfig.rb index a2221f0..e924696 100755 --- a/tool/mkconfig.rb +++ b/tool/mkconfig.rb @@ -202,8 +202,6 @@ print < $@ =20 diff --git a/win32/resource.rb b/win32/resource.rb index 786edb0..34a1df2 100755 --- a/win32/resource.rb +++ b/win32/resource.rb @@ -2,7 +2,7 @@ =20 require './rbconfig' =20 -CONFIG =3D RbConfig::MAKEFILE_CONFIG +CONFIG =3D RbConfig.makefile_config =20 version =3D RUBY_VERSION.split(/\./) patch =3D CONFIG['PATCHLEVEL'] --=20 Aaron Patterson http://tenderlovemaking.com/ --QKdGvSO+nmPlgiQ/ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (Darwin) iQEcBAEBAgAGBQJOE43YAAoJEJUxcLy0/6/GSGsH/2YIpgpAew2g2hNCiSWquv2h xpFmx6hebVpLxpO0qyo4rkYRt6NYqakN8MjNr0SuefdGiZfBXuh3mye6NthdNd1i buHw5WLxcmjY750ghdSrFb29UlDnOONBcJIKJeVIL2JwaXsxNa1pQjRnltKsqhPu b96DRlTfgTwZGI/CeBglZj3z6Sr9B5cyjtrDhu584ORXu7NgvYMdacQhTSG71/Am NithvshKkV9X9ME6iKG2hFbOqytPH3e1HjxT4nyUADQAZoxotAGVTwrjlbrCQzPk zhX9Y8BlddnVaqC6eM5p6alPVE4J6x6Dxss3uulhvz+WmKz039KFrhmN4DpXE6Y= =cSEL -----END PGP SIGNATURE----- --QKdGvSO+nmPlgiQ/--