The new version of JSA, a script analysis, compression, and obfuscation tool, is released. The compression efficiency is improved by about 10% _ javascript skills

Source: Internet
Author: User
The new version of JSA, a tool for script analysis, compression, and obfuscation, increases compression efficiency by about 10% SA 1.0 Alpha release and compression efficiency by about 10%
Compression Algorithm Improvement:

Implemented your own text compression algorithm

* Improves the compression ratio and decompression efficiency.

Optimized syntax Compression

* Merge consecutive var statements,
* The redundant var statement is deleted,
* Excessive Large arc brackets ({,}) are deleted ({,}),
* Excessive semicolons (;) are deleted (;).

UI improvement:

* Automatic encoding and Recognition
* Supports file drag and drop
* Supports java 1.4.2 + when the jar open mode is java, you can double-click it to run it. However, if the open mode of JAR is modified (such as winrar), use the following method:
CMD> java-jar xx. jar
* Format
Annotations can only be separated between statements. Comments inserted in the middle of the statement may be lost. When formatting, It is a bug.
* Compression parameter settings
Operation-> Settings:
Execute syntax compression: replace local variables and delete redundant syntax.
Execute text compression: compress the word segmentation and replacement of script text. You can use eval (extract function () to restore the file during execution.
Compatible with IE5 and NS3: Regular Expressions are preferred in earlier versions of browsers. Do you need to be compatible with regular expressions? (a slightly more complex decompression function is required ).
Condition settings for executing text compression: set when to use text compression. There are two requirements: ratio requirement and size requirement. Because eval requires additional overhead, text compression is used only when the ratio of Text compression is smaller than the specified value and the file size is greater than the specified value.


ANT Task

* Default encoding: the default JRE encoding may vary with random machines. Therefore, we recommend that you manually specify the encoding method (eg: charset = "UTF-8"/charset = "GBK ")
* Jsicompile task: Compile JSI (compression, preload compilation, and custom Startup File)
* Jscompress compression script

ANT Task example
Example of jsicompiler (processing JSI and its integrated third-party scripts)
Xml Code

The Code is as follows:






























Example of jscompress (compressing common scripts)
Xml Code

<Target name = "test-compress"> <jscompress destDir = "ant/temp/script3"> <fileset dir = "web/scripts"> <include name = "js /* */*. js? 1.1.9 "/> <include name =" *. js? 1.1.9 "/> </fileset> </jscompress> </target>
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.