Sha256: f038a4aa082db8a4a9edac4793f1434fc39c0d10beae7bedb38c9bee16613a4c

Contents?: true

Size: 874 Bytes

Versions: 4

Compression:

Stored size: 874 Bytes

Contents

engine = ARGV[0] == "therubyracer" ? "therubyracer" : "MiniRacer"

if ARGV[0] == "rubyracer"
  require 'therubyracer'
  puts "Benching with therubyracer"
else
  require 'mini_racer'
  puts "Benching with MiniRacer"
end

require 'uglifier'

if ARGV[0] == "rubyracer"
  ExecJS.runtime = ExecJS::RubyRacerRuntime.new
else
  ExecJS.runtime = ExecJS::MiniRacerRuntime.new
end

start = Time.new
Uglifier.compile(File.read("discourse_app.js"))
puts "#{engine} minify discourse_app.js #{(Time.new - start)*1000}ms"

start = Time.new
Uglifier.compile(File.read("discourse_app_minified.js"))
puts "#{engine} minify discourse_app_minified.js #{(Time.new - start)*1000}ms"

start = Time.new
(0..1).map do
  Thread.new do
    Uglifier.compile(File.read("discourse_app.js"))
  end
end.each(&:join)

puts "#{engine} minify discourse_app.js twice (2 threads) #{(Time.new - start)*1000}ms"

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mini_racer-0.1.0.beta.3 benchmarks/bench_uglify.rb
mini_racer-0.1.0.beta.2 benchmarks/bench_uglify.rb
mini_racer-0.1.0.beta.1-x86_64-linux benchmarks/bench_uglify.rb
mini_racer-0.1.0.beta.1 benchmarks/bench_uglify.rb