Release an efficient JavaScript analysis and compression tool JavaScript Analyser
Let me post a script compression example first to showcase JSA syntax compression and optimization functions.
try {
//xxxx();
}
catch (e) {
yyyy();
function f1() {
}
}
finally {
zzzz();
}
function f2(var1) {
var var2 = 2;
var var3 = 3;
var withObject = {var2:-2}
with(withObject){
alert(var2);
}
}
Compressed results (formatted for easy access):
zzzz();
function f2(A) {
var var2 = 2;
var B = 3;
var C = {var2:-2};
with (C) {
alert(var2);
}
}
The compression process of JSA is divided into two steps
The first step is syntax compression, similar to Dojo ShrinkSafe, but safer than it and more effective.
The second step is text compression, currently
JavaScript Compressor compression algorithm.
(/packer/ )
These can be set in the Settings window.
By default, syntax compression is first used. Text compression is used on the original basis when the file is larger than 1000byte and text compression can still be compressed to 90% of the original size.
Comparison with compression ratios of other compression tools:
1. JavaScript Compressor(http:// /packer/)
With his own compression tool code as an example (v2.02) Packer compressed size is 7,428 bytes (remove comments).
And our compression tool can be compressed to 7,256 bytes
7256 / 7428 = 0.9768443726440496
ShrinkSafe (Rough things are both inefficient and dangerous. It is recommended that the original user change it as soon as possible)
As an example with his own framework source code (v0.4.1):
He compresses the size to 149,518 bytes, and after compression we can shrink it to 81,261 bytes
81261 / 149518 = 0.5434864029748927
Safety instructions:
Compressor
Based on text compression, I did not look at the logic in it carefully, but the possibility of this compression problem is very low. Our compression tool also uses its compression algorithm, in JSI 1.1 a8 and
No exception was found in the test of its integrated third-party library. And there is also a well-known framework JQuery, so I believe there will be no problem.
Supplement (2007-03-12): Today I found that this thing has a bug when analyzing JavaScript multi-line string syntax. However, this problem will no longer exist after being compressed by JSA syntax.
ShrinkSafe Danger! ! ! ! !
Replace the long local variable name with a shorter name. This is an extremely unsafe compression tool, giving an example:
javascript code
function(){
var withObject = {variable1:1}
var variable1 = 2;
with(withObject){
alert(variable1);
}
}
Compress to:
function(){
var _1={variable1:1};
var _2=2;
with(_1){
alert(_2);
}
}
This is obviously wrong, this garbage doesn't pay attention to some special syntax, and dynamics of JavaScript.
No processing is done for eval functions, catch operations, and with statements.
In contrast, JSA is the safest and most effective compression tool I know at present.
JSA not only provides code compression functions, but also can be used for formatting and script analysis.
Script analysis can be used to view script information and find potential problems in scripts.
For example, check which functions and variables are declared in the script.
Those external variables were used. etc. . .
Download address:
/project/?group_id=175776
or
File list
Let me post a script compression example first to showcase JSA syntax compression and optimization functions.
Copy the codeThe code is as follows:
try {
//xxxx();
}
catch (e) {
yyyy();
function f1() {
}
}
finally {
zzzz();
}
function f2(var1) {
var var2 = 2;
var var3 = 3;
var withObject = {var2:-2}
with(withObject){
alert(var2);
}
}
Compressed results (formatted for easy access):
Copy the codeThe code is as follows:
zzzz();
function f2(A) {
var var2 = 2;
var B = 3;
var C = {var2:-2};
with (C) {
alert(var2);
}
}
The compression process of JSA is divided into two steps
The first step is syntax compression, similar to Dojo ShrinkSafe, but safer than it and more effective.
The second step is text compression, currently
JavaScript Compressor compression algorithm.
(/packer/ )
These can be set in the Settings window.
By default, syntax compression is first used. Text compression is used on the original basis when the file is larger than 1000byte and text compression can still be compressed to 90% of the original size.
Comparison with compression ratios of other compression tools:
1. JavaScript Compressor(http:// /packer/)
With his own compression tool code as an example (v2.02) Packer compressed size is 7,428 bytes (remove comments).
And our compression tool can be compressed to 7,256 bytes
7256 / 7428 = 0.9768443726440496
ShrinkSafe (Rough things are both inefficient and dangerous. It is recommended that the original user change it as soon as possible)
As an example with his own framework source code (v0.4.1):
He compresses the size to 149,518 bytes, and after compression we can shrink it to 81,261 bytes
81261 / 149518 = 0.5434864029748927
Safety instructions:
Compressor
Based on text compression, I did not look at the logic in it carefully, but the possibility of this compression problem is very low. Our compression tool also uses its compression algorithm, in JSI 1.1 a8 and
No exception was found in the test of its integrated third-party library. And there is also a well-known framework JQuery, so I believe there will be no problem.
Supplement (2007-03-12): Today I found that this thing has a bug when analyzing JavaScript multi-line string syntax. However, this problem will no longer exist after being compressed by JSA syntax.
ShrinkSafe Danger! ! ! ! !
Replace the long local variable name with a shorter name. This is an extremely unsafe compression tool, giving an example:
javascript code
function(){
var withObject = {variable1:1}
var variable1 = 2;
with(withObject){
alert(variable1);
}
}
Compress to:
function(){
var _1={variable1:1};
var _2=2;
with(_1){
alert(_2);
}
}
This is obviously wrong, this garbage doesn't pay attention to some special syntax, and dynamics of JavaScript.
No processing is done for eval functions, catch operations, and with statements.
In contrast, JSA is the safest and most effective compression tool I know at present.
JSA not only provides code compression functions, but also can be used for formatting and script analysis.
Script analysis can be used to view script information and find potential problems in scripts.
For example, check which functions and variables are declared in the script.
Those external variables were used. etc. . .
Download address:
/project/?group_id=175776
or
File list