diff options
author | Mihai Bazon <mihai@bazon.net> | 2012-09-10 18:25:52 +0300 |
---|---|---|
committer | Mihai Bazon <mihai@bazon.net> | 2012-09-10 22:29:18 +0300 |
commit | 6b9aeb5325203a9f4c8e3bdd6bd3f45f8520ee2e (patch) | |
tree | ce13bb050325787dd6457bae95442170832640b6 /tmp/test-node.js | |
parent | a41e6cfabb0befc0b71c95aa55ac0568cce36518 (diff) | |
download | tracifyjs-6b9aeb5325203a9f4c8e3bdd6bd3f45f8520ee2e.tar.gz tracifyjs-6b9aeb5325203a9f4c8e3bdd6bd3f45f8520ee2e.zip |
adaptive base54 digits depending on char frequency (WIP)
Diffstat (limited to 'tmp/test-node.js')
-rwxr-xr-x | tmp/test-node.js | 48 |
1 files changed, 4 insertions, 44 deletions
diff --git a/tmp/test-node.js b/tmp/test-node.js index 01ae35a7..85dc1b1a 100755 --- a/tmp/test-node.js +++ b/tmp/test-node.js @@ -8,47 +8,7 @@ var UglifyJS = require("../tools/node"); var filename = process.argv[2]; var code = fs.readFileSync(filename, "utf8"); -var ast = time_it("parse", function() { - return UglifyJS.parse(code); -}); - -time_it("scope", function(){ - // calling figure_out_scope is a prerequisite for mangle_names, - // scope_warnings and compress - // - // perhaps figure_out_scope should be called automatically by the - // parser, but there might be instances where the functionality is - // not needed. - ast.figure_out_scope(); -}); - -ast.scope_warnings(); - -time_it("mangle", function(){ - ast.mangle_names(); -}); - -time_it("compress", function(){ - var compressor = new UglifyJS.Compressor({ - // sequences : true, - // properties : true, - // dead_code : true, - // keep_comps : true, - // drop_debugger : true, - // unsafe : true, - // warnings : true - }); - ast = ast.squeeze(compressor); -}); - -var stream = UglifyJS.OutputStream({ beautify: true }); -time_it("generate", function(){ - ast.print(stream); -}); -sys.puts(stream.get()); - -function time_it(name, cont) { - var t1 = new Date().getTime(); - try { return cont(); } - finally { sys.debug("// " + name + ": " + ((new Date().getTime() - t1) / 1000).toFixed(3) + " sec."); } -}; +var ast = UglifyJS.parse(code); +ast.figure_out_scope(); +ast.compute_char_frequency(); +console.log(UglifyJS.base54.get().join(",")); |