Skip to content

Instantly share code, notes, and snippets.

@munkyboy
Created August 31, 2010 00:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save munkyboy/558316 to your computer and use it in GitHub Desktop.
Save munkyboy/558316 to your computer and use it in GitHub Desktop.
diff --git a/lib/ruby/site_ruby/1.8/rubygems/config_file.rb b/lib/ruby/site_ruby/1.8/rubygems/config_file.rb
index 7eb755a..8eac97d 100644
--- a/lib/ruby/site_ruby/1.8/rubygems/config_file.rb
+++ b/lib/ruby/site_ruby/1.8/rubygems/config_file.rb
@@ -52,13 +52,13 @@ class Gem::ConfigFile
CSIDL_COMMON_APPDATA = 0x0023
path = 0.chr * 260
if RUBY_VERSION > '1.9' then
- SHGetFolderPath = Win32API.new 'shell32', 'SHGetFolderPath', 'PLPLP',
+ f = Win32API.new 'shell32', 'SHGetFolderPath', 'PLPLP',
'L', :stdcall
- SHGetFolderPath.call nil, CSIDL_COMMON_APPDATA, nil, 1, path
+ f.call nil, CSIDL_COMMON_APPDATA, nil, 1, path
else
- SHGetFolderPath = Win32API.new 'shell32', 'SHGetFolderPath', 'LLLLP',
+ f = Win32API.new 'shell32', 'SHGetFolderPath', 'LLLLP',
'L'
- SHGetFolderPath.call 0, CSIDL_COMMON_APPDATA, 0, 1, path
+ f.call 0, CSIDL_COMMON_APPDATA, 0, 1, path
end
path.strip
require 'java'; require 'benchmark'
def foo
Benchmark.measure {
sc = org.jruby.embed.ScriptingContainer.new(org.jruby.embed.LocalContextScope::SINGLETHREAD, org.jruby.embed.LocalVariableBehavior::TRANSIENT)
sc.runScriptlet("require 'rubygems'")
sc.terminate
sc = nil
}
end
i = 0
while(true); i += 1; puts "loop #{i} took #{foo}"; JRuby.gc; end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment