Skip to content

Instantly share code, notes, and snippets.

@juliocesar
Created December 17, 2010 00:14
Show Gist options
  • Save juliocesar/744259 to your computer and use it in GitHub Desktop.
Save juliocesar/744259 to your computer and use it in GitHub Desktop.
closure-compiler compiling an empty method
>> require 'closure-compiler'
=> true
>> require 'benchmark'
=> true
>> puts Benchmark.measure { Closure::Compiler.new.compile 'function foo() {}' }
0.000000 0.010000 2.600000 ( 1.571835)
=> nil
>> puts Benchmark.measure { Closure::Compiler.new.compile 'function foo() {}' }
0.000000 0.000000 2.630000 ( 1.624686)
=> nil
^ 2.6 seconds to compress that. Seriously?
For the record, I understand that's the time it takes to
call out to Java to execute the .jar file. Still, for what
I'm building, it's an awful lot expensive.
EDIT: Solution so far → https://github.com/rgrove/jsmin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment