mirror of
https://github.com/rubyjs/mini_racer
synced 2023-03-27 23:21:28 -04:00
clean up bench
This commit is contained in:
parent
60f5b023c6
commit
bce94a0887
3 changed files with 12 additions and 10 deletions
3
benchmarks/Gemfile
Normal file
3
benchmarks/Gemfile
Normal file
|
@ -0,0 +1,3 @@
|
|||
source 'https://rubygems.org'
|
||||
gem 'mini_racer', '0.1.0.beta.3'
|
||||
gem 'uglifier'
|
|
@ -1,14 +1,13 @@
|
|||
require 'execjs'
|
||||
|
||||
engines = {
|
||||
mini_racer: ExecJS::Runtimes::MiniRacer,
|
||||
rubyracer: ExecJS::Runtimes::RubyRacer,
|
||||
duktape: ExecJS::Runtimes::Duktape,
|
||||
node: ExecJS::Runtimes::Node
|
||||
mini_racer: proc { ExecJS::MiniRacerRuntime.new },
|
||||
therubyracer: proc { ExecJS::RubyRacerRuntime.new },
|
||||
rhino: proc { ExecJS::RubyRhinoRuntime.new },
|
||||
duktape: proc { ExecJS::DuktapeRuntime.new},
|
||||
node: proc { ExecJS::Runtimes::Node }
|
||||
}
|
||||
|
||||
engine = ARGV[0]
|
||||
unless engine && (runtime = engines[engine.to_sym])
|
||||
unless engine && (execjs_engine = engines[engine.to_sym])
|
||||
STDERR.puts "Unknown engine try #{engines.keys.join(',')}"
|
||||
exit 1
|
||||
end
|
||||
|
@ -16,10 +15,11 @@ end
|
|||
unless engine == "node"
|
||||
require engine
|
||||
end
|
||||
|
||||
puts "Benching with #{engine}"
|
||||
require 'uglifier'
|
||||
|
||||
ExecJS.runtime = runtime
|
||||
ExecJS.runtime = execjs_engine.call
|
||||
|
||||
start = Time.new
|
||||
Uglifier.compile(File.read("discourse_app.js"))
|
||||
|
|
|
@ -477,11 +477,10 @@ VALUE allocate(VALUE klass) {
|
|||
init_v8();
|
||||
|
||||
ContextInfo* context_info = ALLOC(ContextInfo);
|
||||
|
||||
context_info->allocator = new ArrayBufferAllocator();
|
||||
|
||||
Isolate::CreateParams create_params;
|
||||
create_params.array_buffer_allocator = context_info->allocator;
|
||||
|
||||
context_info->isolate = Isolate::New(create_params);
|
||||
|
||||
Locker lock(context_info->isolate);
|
||||
|
|
Loading…
Reference in a new issue