JSC (Java Script Compressor)
2006/05/16 Kazuki OhtaIntroduction
A JavaScript Compressor, which reduces the code size of JavaScript sources. The aim is to lower the latency to load a profile of javascript library files. NOTICE, this software is still in the beta stage.Features
- Parsing & Lexing JS code and output the small code which behaves as same as the original code.
- remove needless spaces
- remove needless newlines
Download
- This software is distributed under the terms of 'LGPL', because internally this software uses KDE's kjs code (parser & lexer).
- Source
Install
-
Requirements
- C++ Compiler (gcc-3.x or higher is recommendded)
-
How to make
$ ./configure $ make
Usage
ubuntu% ./jsc prototype-1.4.0.js > tmp2 ubuntu% ./jsc tmp2 > tmp3 ubuntu% diff -u tmp2 tmp3
If diff doesn't output anything, the code compressing ends successfully. You must check this. If there's a difference between tmp2 and tmp3, that's a bug of jsc. So please report to me.
Example
ubuntu% ./jsc prototype-1.4.0.js > prototype-compressed-1.4.0.js ubuntu% ls -al prototype-1.4.0.js -rw------- 1 kzk kzk 47445 2006-01-21 05:09 prototype-1.4.0.js ubuntu% ls -al prototype-compressed-1.4.0.js -rw------- 1 kzk kzk 34987 2006-05-16 10:50 prototype-compressed-1.4.0.js ubuntu% ls -al prototype-1.4.0.js.gz -rw------- 1 kzk kzk 10543 2006-01-21 05:09 prototype-1.4.0.js.gz ubuntu% ls -al prototype-compressed-1.4.0.js.gz -rw------- 1 kzk kzk 8544 2006-05-16 11:16 prototype-compressed-1.4.0.js.gz
Future Plans
- Rename identifiers to more shorter name
- Some code optimizations
- inline function expantion
- threaded code
- or any other techniques?
History
- 2006/05/16
- initial release (version 0.1.0)
[ return ]