Skip to content

Instantly share code, notes, and snippets.

@headius
Created January 21, 2020 18:50
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 headius/cf8af0793c7ca3e04211589b4d279421 to your computer and use it in GitHub Desktop.
Save headius/cf8af0793c7ca3e04211589b4d279421 to your computer and use it in GitHub Desktop.
# Update path to persisted erb.ir: jruby -Xir.writing -rerb -e 1
java_import org.jruby.util.ByteList, org.jruby.ir.persistence.IRReader, org.jruby.ir.persistence.IRReaderStream
manager = JRuby.runtime.ir_manager
filename = "/Users/headius/.ir/Users/headius/projects/jruby/lib/ruby/stdlib/erb.ir"
encoding = org.jcodings.specific.UTF8Encoding::INSTANCE
filename_bytes = ByteList.new(filename.to_java_bytes, encoding)
10.times do
t = Time.now
10.times do
stream = IRReaderStream.new(manager, File.open(filename).to_inputstream, filename_bytes)
IRReader.load(manager, stream)
end
puts Time.now - t
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment