Comments (10)
What JS runtime are you using? Tests pass with therubyrhino and jruby 1.6.5 (Travis CI, other libraries use C-extensions which are known to have problems on JRuby.
from uglifier.
$ jruby -v
jruby 1.6.5 (ruby-1.9.2-p136) (2011-10-25 9dcd388) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_29) [darwin-x86_64-java]
gives
$ jruby -e "require 'uglifier'; Uglifier.compile File.read 'jquery-1.7.1.js'"
java(25487,0x10f18a000) malloc: *** error for object 0x7f9604a05300: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6
from uglifier.
What does jruby -e "require 'uglifier'; puts ExecJS.runtime
say? You might also want to try EXECJS_RUNTIME =RubyRhino jruby -e "require 'uglifier' …"
from uglifier.
#ExecJS::RubyRhinoRuntime:0x3710b205
On Wed, Dec 21, 2011 at 14:01, Ville Lautanala
[email protected]
wrote:
What does
jruby -e "require 'uglifier'; puts ExecJS.runtime
say? You might also want to tryEXECJS_RUNTIME =RubyRhino jruby -e "require 'uglifier' …"
Reply to this email directly or view it on GitHub:
#22 (comment)
from uglifier.
I can't replicate this with jruby 1.6.5 (running in 1.9 mode on same 64bit jvm).
Can you run anything with ExecJS? E.g. ExecJS.eval '1+1'
?
from uglifier.
indeed and uglifier works for very small files as well, but not with
for example jquery (http://code.jquery.com/jquery-1.7.1.js)
On Wed, Dec 21, 2011 at 14:21, Ville Lautanala
[email protected]
wrote:
I can't replicate this with jruby 1.6.5 (running in 1.9 mode on same 64bit jvm).
Can you run anything with ExecJS? E.g. `ExecJS.eval '1+1'?
Reply to this email directly or view it on GitHub:
#22 (comment)
from uglifier.
I managed to replicate the segfault with yajl-ruby
gem. It uses C extensions, which AFAIK are still experimental in JRuby.
Uglifier uses multi_json
, which tries to load the best available JSON parser. You can manually change the used engine to something which works on your platform with MultiJson.engine = :json_gem
or just remove yajl-ruby from your Gemfile/system.
from uglifier.
ok, thanks! no seg fault, but still very slow..
$ jruby -b -e "require 'uglifier'; Uglifier.compile File.read 'jquery-1.7.1.js'"
Runtime: 62870 ms
$ jruby -b -e "require 'closure-compiler'; Closure::Compiler.new.compress File.read 'jquery-1.7.1.js'"
Runtime: 11416 ms
with ruby 1.9.3
$ time ruby -e "require 'uglifier'; Uglifier.compile File.read 'jquery-1.7.1.js'"
real 0m2.863s
user 0m2.598s
sys 0m0.122s
$ time ruby -e "require 'closure-compiler'; Closure::Compiler.new.compress File.read 'jquery-1.7.1.js'"
real 0m8.992s
user 0m22.781s
sys 0m0.598s
from uglifier.
Yeah. Especially the first run with fresh jvm is extremely slow with RubyRhino. Using V8/Node.js runtime makes Uglifier much faster, but it requires you to have node
in your PATH and forcing ExecJS to use Node (ExecJS.runtime = ExecJS::Runtimes::Node
)
Quick runs with benchmark:
RubyRhino Cold JVM: 55.332000s
RubyRhino Second run: 21.028000s
Node: 3.539000s
from uglifier.
ok :)
from uglifier.
Related Issues (20)
- Uglify changing order of declaration
- Uglify 4 having problems with ES6 assets, while 3 works fine HOT 3
- Uglifier mangle properties has a start_with? undefined error on nil:NilClass HOT 1
- Example for harmony in readme is very dangerous HOT 4
- inlining dependencies HOT 2
- Jekyll configuration to use ES6
- Different versions between `VERSION` and published HOT 2
- Uglifier::Error: Unexpected token: name (package)
- Uglifier::Error: HOT 6
- Uglifier Cannot Precompile JS Optional Chaining HOT 3
- Uglifier runs into problems with certain combination of modern JS syntax (await, destructuring, Promise.all) HOT 1
- Uglifier complains about field declaration syntax HOT 1
- NoMethodError: undefined method `start_with?' for nil:NilClass HOT 1
- jekyll 3.8.7 | Error: Unexpected token: keyword (const). To use ES6 syntax, harmony mode must be enabled with Uglifier.new(:harmony => true).
- Changing Uglifier.new parameters does nothing if I dont clean manually the assets files first HOT 2
- Documentation for :define => {} ?
- Custom replacements
- Uglifier::Error: - Solution: Switch to terser HOT 15
- Uglifier::Error: Unexpected token: punc (.) HOT 4
- Uglifier error in production mode on RoR 7.0.3.1 with Bootstrap 5.2 HOT 16
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from uglifier.