101 lines
4.3 KiB
HTML
101 lines
4.3 KiB
HTML
<!-- ***** BEGIN LICENSE BLOCK *****
|
|
- Version: MPL 1.1/GPL 2.0
|
|
-
|
|
- The contents of this file are subject to the Mozilla Public License Version
|
|
- 1.1 (the "License"); you may not use this file except in compliance with
|
|
- the License. You may obtain a copy of the License at
|
|
- http://www.mozilla.org/MPL/
|
|
-
|
|
- Software distributed under the License is distributed on an "AS IS" basis,
|
|
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
- for the specific language governing rights and limitations under the
|
|
- License.
|
|
-
|
|
- The Original Code is Rhino code, released May 6, 1999.
|
|
-
|
|
- The Initial Developer of the Original Code is
|
|
- Netscape Communications Corporation.
|
|
- Portions created by the Initial Developer are Copyright (C) 1997-1999
|
|
- the Initial Developer. All Rights Reserved.
|
|
-
|
|
- Contributor(s):
|
|
-
|
|
- Alternatively, the contents of this file may be used under the terms of
|
|
- the GNU General Public License Version 2 or later (the "GPL"), in which
|
|
- case the provisions of the GPL are applicable instead of those above. If
|
|
- you wish to allow use of your version of this file only under the terms of
|
|
- the GPL and not to allow others to use your version of this file under the
|
|
- MPL, indicate your decision by deleting the provisions above and replacing
|
|
- them with the notice and other provisions required by the GPL. If you do
|
|
- not delete the provisions above, a recipient may use your version of this
|
|
- file under either the MPL or the GPL.
|
|
-
|
|
- ***** END LICENSE BLOCK ***** -->
|
|
|
|
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
<meta name="Author" content="Norris Boyd">
|
|
<meta name="GENERATOR" content="Mozilla/4.51 [en] (WinNT; U) [Netscape]">
|
|
<title>Small Footprint</title>
|
|
</head>
|
|
<body bgcolor="#FFFFFF">
|
|
|
|
<center>
|
|
<h1>
|
|
Small Footprint</h1></center>
|
|
A few changes can be made to reduce the footprint of Rhino for embeddings
|
|
where space is at a premium. On a recent build, the length of js.jar was 603,127 bytes corresponding to 1,171,708 bytes of all uncompressed Rhino classes with debug information included.
|
|
With various changes js.jar size can be reduced to 204,689 bytes corresponding to 424,774 bytes of uncompressed classes.
|
|
|
|
<h3>Tools</h3>
|
|
<p>
|
|
Most embeddings won't need any of the classes in <tt>org.mozilla.javascript.tools</tt> or any of its sub-packages.
|
|
<h3>
|
|
Optimizer</h3>
|
|
<p>
|
|
It is possible to run Rhino with interpreter mode only, allowing you to remove
|
|
code for classfile generation that include all the classes from
|
|
<tt>org.mozilla.javascript.optimizer</tt> package.
|
|
|
|
<h3>JavaAdapter</h3>
|
|
<p>
|
|
Implementing the JavaAdapter functionality requires the ability to generate
|
|
classes on the fly. Removing <tt>org.mozilla.javascript.JavaAdapter</tt> will disable this functionality, but Rhino will otherwise run correctly.
|
|
|
|
<h3>Class generation library</h3>
|
|
<p>
|
|
If you do not include Optimizer or JavaAdapter, nor do you use PolicySecurityController then you do not need Rhino library for class file generation and you can remove all the classes from in <tt>org.mozilla.classfile</tt> package.
|
|
|
|
<h3>Regular Expressions</h3>
|
|
<p>
|
|
The package <tt>org.mozilla.javascript.regexp</tt> can be removed. Rhino
|
|
will continue to run, although it will not be able to execute any regular
|
|
expression matches. This change saves 47,984 bytes of class files.
|
|
|
|
<h3>Debug information</h3>
|
|
<p>
|
|
Debug information in Rhino classes consumes about 25% of code size and if you can live without that, you can recompile Rhino to remove it.
|
|
|
|
<h2>smalljs.jar</h2>
|
|
<p>
|
|
Ant build script in Rhino supports smalljar target that will generate
|
|
smalljs.jar that does not include Tools, Optimizer, JavaAdapter and Class
|
|
generation library, Regular Expressions, E4X implementataion and deprecated
|
|
files. To build such minimalist jar without debug information, run the
|
|
following command from the top directory of Rhino distribution:
|
|
<pre>
|
|
ant clean
|
|
ant -Ddebug=off -Dno-regexp=true -Dno-e4x=true smalljar
|
|
</pre>
|
|
If you omit <tt>-Dno-regexp=true</tt>, then the resulting smalljs.jar will
|
|
include Regular Expression support. Similarly omitting <tt>-Dno-e4x=true</tt>
|
|
results in smalljs.jar that includes runtime support for E4X.
|
|
|
|
<p>
|
|
<hr WIDTH="100%">
|
|
<br><a href="index.html">back to top</a>
|
|
</body>
|
|
</html>
|