200 lines
9.4 KiB
Plaintext
200 lines
9.4 KiB
Plaintext
.. copyright:
|
|
Copyright 2011 - 2014
|
|
André Malo or his licensors, as applicable
|
|
|
|
.. license:
|
|
Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
|
|
:orphan:
|
|
|
|
|
|
====================
|
|
rJSmin - Benchmark
|
|
====================
|
|
|
|
The following numbers have been measured with the bench package provided
|
|
in the source distribution. Since the numbers don't vary much between
|
|
python minor releases (e.g. 2.6 vs 2.7), only one benchmark per major
|
|
version is given below. The :file:`docs/BENCHMARKS` file in the source
|
|
distribution contains a more comprehensive list.
|
|
|
|
Here's the list of benchmarked implementations:
|
|
|
|
**Simple port**
|
|
The original jsmin.py port by Baruch Even
|
|
|
|
**jsmin 2.0.9**
|
|
A speed-refactored python port by Dave St.Germain. There are some
|
|
spikes in lower Python 3 versions (especially for the big file
|
|
[apiviewer.js]).
|
|
|
|
**slimit 0.8.1**
|
|
A minifier based on a parse/generate-iteration. Its Python3 support
|
|
seems to be incomplete as it fails with several inputs. Python2
|
|
support actually starts with Python 2.6 (name mangeling uses Python
|
|
2.6 features)
|
|
|
|
It could not be installed with Python 3.0 and Python 2.4.
|
|
|
|
**slimit 0.8.1 (mangle)**
|
|
Same as slimit 0.8.1, but with name mangeling enabled.
|
|
|
|
|**rjsmin**|
|
|
this very project
|
|
|
|
**_**\ |**rjsmin**|
|
|
The C reimplementation of |rjsmin|
|
|
|
|
Note that the various implementations produce output different from the
|
|
original jsmin.c for one reason or another. Also the simple port was
|
|
modified to use ``cStringIO`` if available (it's faster then) or io (for
|
|
python 3).
|
|
|
|
And here's a list of the benchmarked javascript files:
|
|
|
|
- apiviewer is a file from the qooxdoo framework. Very big and already
|
|
compressed.
|
|
- bootstrap is the popular twitter toolkit, version 2.0.4
|
|
- jquery is jquery-1.7.1.js; the uncompressed development download.
|
|
- knockout is knockout-2.0.0.js, the compressed download.
|
|
- markermanager is the V3 port of the google maps markermanager.
|
|
|
|
Inside the parentheses are size information in KiB [#]_\. The sign
|
|
behind the size value denotes the size difference in relation to the
|
|
simple port (i.e. jsmin itself).
|
|
|
|
.. [#] Bytes / 1024 for Python 2 and Code Points / 1024 for Python 3
|
|
|
|
|
|
.. begin tables
|
|
|
|
Python 3.4.0
|
|
~~~~~~~~~~~~
|
|
|
|
.. rst-class:: benchmark
|
|
|
|
+-----------------------+------------------------+----------------------+
|
|
| Name | apiviewer (953.2) | bootstrap (49.0) |
|
|
+=======================+========================+======================+
|
|
| Simple Port | 2083.14 ms (951.5 \*) | 90.13 ms (26.4 \*) |
|
|
+-----------------------+------------------------+----------------------+
|
|
| jsmin 2.0.9 | 2439.38 ms (951.5 >) | 38.70 ms (26.4 >) |
|
|
+-----------------------+------------------------+----------------------+
|
|
| slimit 0.8.1 | (failed) | (failed) |
|
|
+-----------------------+------------------------+----------------------+
|
|
| slimit 0.8.1 (mangle) | (failed) | (failed) |
|
|
+-----------------------+------------------------+----------------------+
|
|
| |rjsmin| | 56.03 ms (951.5 =) | 13.78 ms (26.4 >) |
|
|
+-----------------------+------------------------+----------------------+
|
|
| _\ |rjsmin| | 2.11 ms (951.5 =) | 0.17 ms (26.4 >) |
|
|
+-----------------------+------------------------+----------------------+
|
|
|
|
.. rst-class:: benchmark
|
|
|
|
+-----------------------+------------------------+----------------------+
|
|
| Name | jquery (242.4) | knockout (38.9) |
|
|
+=======================+========================+======================+
|
|
| Simple Port | 468.94 ms (135.9 \*) | 83.92 ms (38.6 \*) |
|
|
+-----------------------+------------------------+----------------------+
|
|
| jsmin 2.0.9 | 251.12 ms (136.8 >) | 42.35 ms (38.6 >) |
|
|
+-----------------------+------------------------+----------------------+
|
|
| slimit 0.8.1 | (failed) | (failed) |
|
|
+-----------------------+------------------------+----------------------+
|
|
| slimit 0.8.1 (mangle) | (failed) | (failed) |
|
|
+-----------------------+------------------------+----------------------+
|
|
| |rjsmin| | 95.54 ms (135.9 =) | 2.87 ms (38.6 >) |
|
|
+-----------------------+------------------------+----------------------+
|
|
| _\ |rjsmin| | 1.12 ms (135.9 =) | 0.09 ms (38.6 >) |
|
|
+-----------------------+------------------------+----------------------+
|
|
|
|
.. rst-class:: benchmark
|
|
|
|
+-----------------------+------------------------+----------------------+
|
|
| Name | markermanager (28.6) | |
|
|
+=======================+========================+======================+
|
|
| Simple Port | 44.58 ms (11.6 \*) | |
|
|
+-----------------------+------------------------+----------------------+
|
|
| jsmin 2.0.9 | 19.18 ms (11.6 >) | |
|
|
+-----------------------+------------------------+----------------------+
|
|
| slimit 0.8.1 | 149.82 ms (11.5 <) | |
|
|
+-----------------------+------------------------+----------------------+
|
|
| slimit 0.8.1 (mangle) | 174.04 ms (9.3 <) | |
|
|
+-----------------------+------------------------+----------------------+
|
|
| |rjsmin| | 5.88 ms (11.6 =) | |
|
|
+-----------------------+------------------------+----------------------+
|
|
| _\ |rjsmin| | 0.08 ms (11.6 =) | |
|
|
+-----------------------+------------------------+----------------------+
|
|
|
|
|
|
Python 2.7.5
|
|
~~~~~~~~~~~~
|
|
|
|
.. rst-class:: benchmark
|
|
|
|
+-----------------------+------------------------+----------------------+
|
|
| Name | apiviewer (953.2) | bootstrap (49.0) |
|
|
+=======================+========================+======================+
|
|
| Simple Port | 2960.91 ms (951.5 \*) | 118.82 ms (26.4 \*) |
|
|
+-----------------------+------------------------+----------------------+
|
|
| jsmin 2.0.9 | 3087.26 ms (951.5 >) | 60.82 ms (26.4 >) |
|
|
+-----------------------+------------------------+----------------------+
|
|
| slimit 0.8.1 | 13520.48 ms (944.3 <) | 379.62 ms (26.5 >) |
|
|
+-----------------------+------------------------+----------------------+
|
|
| slimit 0.8.1 (mangle) | 16463.29 ms (922.9 <) | 404.06 ms (22.2 <) |
|
|
+-----------------------+------------------------+----------------------+
|
|
| |rjsmin| | 60.45 ms (951.5 =) | 15.94 ms (26.4 >) |
|
|
+-----------------------+------------------------+----------------------+
|
|
| _\ |rjsmin| | 1.92 ms (951.5 =) | 0.18 ms (26.4 >) |
|
|
+-----------------------+------------------------+----------------------+
|
|
|
|
.. rst-class:: benchmark
|
|
|
|
+-----------------------+------------------------+----------------------+
|
|
| Name | jquery (242.4) | knockout (38.9) |
|
|
+=======================+========================+======================+
|
|
| Simple Port | 624.62 ms (135.9 \*) | 118.56 ms (38.6 \*) |
|
|
+-----------------------+------------------------+----------------------+
|
|
| jsmin 2.0.9 | 370.86 ms (136.8 >) | 67.29 ms (38.6 >) |
|
|
+-----------------------+------------------------+----------------------+
|
|
| slimit 0.8.1 | 1800.29 ms (134.0 <) | 703.96 ms (39.0 >) |
|
|
+-----------------------+------------------------+----------------------+
|
|
| slimit 0.8.1 (mangle) | 2129.26 ms (95.0 <) | 844.49 ms (38.9 >) |
|
|
+-----------------------+------------------------+----------------------+
|
|
| |rjsmin| | 113.71 ms (135.9 =) | 3.38 ms (38.6 >) |
|
|
+-----------------------+------------------------+----------------------+
|
|
| _\ |rjsmin| | 1.12 ms (135.9 =) | 0.09 ms (38.6 >) |
|
|
+-----------------------+------------------------+----------------------+
|
|
|
|
.. rst-class:: benchmark
|
|
|
|
+-----------------------+------------------------+----------------------+
|
|
| Name | markermanager (28.6) | |
|
|
+=======================+========================+======================+
|
|
| Simple Port | 59.09 ms (11.6 \*) | |
|
|
+-----------------------+------------------------+----------------------+
|
|
| jsmin 2.0.9 | 30.78 ms (11.6 >) | |
|
|
+-----------------------+------------------------+----------------------+
|
|
| slimit 0.8.1 | 145.18 ms (11.5 <) | |
|
|
+-----------------------+------------------------+----------------------+
|
|
| slimit 0.8.1 (mangle) | 164.81 ms (9.3 <) | |
|
|
+-----------------------+------------------------+----------------------+
|
|
| |rjsmin| | 6.94 ms (11.6 =) | |
|
|
+-----------------------+------------------------+----------------------+
|
|
| _\ |rjsmin| | 0.08 ms (11.6 =) | |
|
|
+-----------------------+------------------------+----------------------+
|
|
|
|
.. end tables
|
|
|
|
|
|
.. vim: ft=rest tw=72
|