177 lines
9.0 KiB
Plaintext
177 lines
9.0 KiB
Plaintext
.. license:
|
|
Copyright 2011 - 2014
|
|
André Malo or his licensors, as applicable
|
|
|
|
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 the benchmarks for
|
|
2.7 and 3.4 are given below. The :file:`docs/BENCHMARKS` file in the source
|
|
distribution contains a more complete list.
|
|
|
|
Here's the list of benchmarked implementations:
|
|
|
|
- Simple port is the original jsmin.py port by Baruch Even
|
|
- jsmin 2.0.9 is a speed-refactored python port by Dave St.Germain
|
|
(it got slower since version 2.0.2 and spikes with Python 3.2 for some
|
|
reason)
|
|
- slimit 0.8.1 is a minifier based on a parse/generate-iteration. Its
|
|
Python3 support seems to be incomplete. It fails with several inputs.
|
|
- slimit 0.8.1 (mangle) is slimit 0.8.1 with name mangeling enabled
|
|
- |rjsmin| is this very project
|
|
- _\ |rjsmin| is the C reimplementation of |rjsmin|
|
|
|
|
Note that jsmin 2.0.9 and slimit produce output different from
|
|
the original jsmin.c. 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 (actually: number of
|
|
characters/1024). The sign behind the size value denotes the size difference
|
|
in relation to the simple port (i.e. jsmin itself).
|
|
|
|
|
|
Python 3.4.0
|
|
~~~~~~~~~~~~
|
|
|
|
.. rst-class:: benchmark
|
|
|
|
+-----------------------+-----------------------+----------------------+
|
|
| Name | apiviewer (953.2) | bootstrap (49.0) |
|
|
+=======================+=======================+======================+
|
|
| Simple Port | 2162.57 ms (951.5 \*)| 90.56 ms (26.4 \*) |
|
|
+-----------------------+-----------------------+----------------------+
|
|
| jsmin 2.0.9 | 2526.19 ms (951.5 >) | 39.41 ms (26.4 >) |
|
|
+-----------------------+-----------------------+----------------------+
|
|
| slimit 0.8.1 | n/a | n/a |
|
|
+-----------------------+-----------------------+----------------------+
|
|
| slimit 0.8.1 (mangle) | n/a | n/a |
|
|
+-----------------------+-----------------------+----------------------+
|
|
| |rjsmin| | 57.31 ms (951.5 =) | 14.05 ms (26.4 >) |
|
|
+-----------------------+-----------------------+----------------------+
|
|
| _\ |rjsmin| | 2.20 ms (951.5 =) | 0.17 ms (26.4 >) |
|
|
+-----------------------+-----------------------+----------------------+
|
|
|
|
.. rst-class:: benchmark
|
|
|
|
+-----------------------+-----------------------+----------------------+
|
|
| Name | jquery (242.4) | knockout (38.9) |
|
|
+=======================+=======================+======================+
|
|
| Simple Port | 474.08 ms (135.9 \*)| 84.49 ms (38.6 \*) |
|
|
+-----------------------+-----------------------+----------------------+
|
|
| jsmin 2.0.9 | 253.22 ms (136.8 >) | 43.57 ms (38.6 >) |
|
|
+-----------------------+-----------------------+----------------------+
|
|
| slimit 0.8.1 | n/a | n/a |
|
|
+-----------------------+-----------------------+----------------------+
|
|
| slimit 0.8.1 (mangle) | n/a | n/a |
|
|
+-----------------------+-----------------------+----------------------+
|
|
| |rjsmin| | 96.61 ms (135.9 =) | 2.92 ms (38.6 >) |
|
|
+-----------------------+-----------------------+----------------------+
|
|
| _\ |rjsmin| | 1.13 ms (135.9 =) | 0.09 ms (38.6 >) |
|
|
+-----------------------+-----------------------+----------------------+
|
|
|
|
.. rst-class:: benchmark
|
|
|
|
+-----------------------+-----------------------+----------------------+
|
|
| Name | markermanager (28.6) | |
|
|
+=======================+=======================+======================+
|
|
| Simple Port | 45.54 ms (11.6 \*) | |
|
|
+-----------------------+-----------------------+----------------------+
|
|
| jsmin 2.0.9 | 19.94 ms (11.6 >) | |
|
|
+-----------------------+-----------------------+----------------------+
|
|
| slimit 0.8.1 | n/a | |
|
|
+-----------------------+-----------------------+----------------------+
|
|
| slimit 0.8.1 (mangle) | n/a | |
|
|
+-----------------------+-----------------------+----------------------+
|
|
| |rjsmin| | 5.97 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 | 2905.73 ms (951.5 \*)| 117.53 ms (26.4 \*) |
|
|
+-----------------------+-----------------------+----------------------+
|
|
| jsmin 2.0.9 | 2996.74 ms (951.5 >) | 59.87 ms (26.4 >) |
|
|
+-----------------------+-----------------------+----------------------+
|
|
| slimit 0.8.1 | 13816.28 ms (944.3 <) | 390.69 ms (26.5 >) |
|
|
+-----------------------+-----------------------+----------------------+
|
|
| slimit 0.8.1 (mangle) | 16937.11 ms (922.9 <) | 415.09 ms (22.2 <) |
|
|
+-----------------------+-----------------------+----------------------+
|
|
| |rjsmin| | 60.79 ms (951.5 =) | 16.10 ms (26.4 >) |
|
|
+-----------------------+-----------------------+----------------------+
|
|
| _\ |rjsmin| | 2.01 ms (951.5 =) | 0.18 ms (26.4 >) |
|
|
+-----------------------+-----------------------+----------------------+
|
|
|
|
.. rst-class:: benchmark
|
|
|
|
+-----------------------+-----------------------+----------------------+
|
|
| Name | jquery (242.4) | knockout (38.9) |
|
|
+=======================+=======================+======================+
|
|
| Simple Port | 616.05 ms (135.9 \*)| 117.73 ms (38.6 \*) |
|
|
+-----------------------+-----------------------+----------------------+
|
|
| jsmin 2.0.9 | 371.60 ms (136.8 >) | 67.54 ms (38.6 >) |
|
|
+-----------------------+-----------------------+----------------------+
|
|
| slimit 0.8.1 | 1849.66 ms (134.0 <) | 730.03 ms (39.0 >) |
|
|
+-----------------------+-----------------------+----------------------+
|
|
| slimit 0.8.1 (mangle) | 2191.50 ms ( 95.0 <) | 866.40 ms (38.9 >) |
|
|
+-----------------------+-----------------------+----------------------+
|
|
| |rjsmin| | 113.46 ms (135.9 =) | 3.44 ms (38.6 >) |
|
|
+-----------------------+-----------------------+----------------------+
|
|
| _\ |rjsmin| | 1.12 ms (135.9 =) | 0.09 ms (38.6 >) |
|
|
+-----------------------+-----------------------+----------------------+
|
|
|
|
.. rst-class:: benchmark
|
|
|
|
+-----------------------+-----------------------+----------------------+
|
|
| Name | markermanager (28.6) | |
|
|
+=======================+=======================+======================+
|
|
| Simple Port | 58.19 ms (11.6 \*) | |
|
|
+-----------------------+-----------------------+----------------------+
|
|
| jsmin 2.0.9 | 30.59 ms (11.6 >) | |
|
|
+-----------------------+-----------------------+----------------------+
|
|
| slimit 0.8.1 | 147.98 ms (11.5 <) | |
|
|
+-----------------------+-----------------------+----------------------+
|
|
| slimit 0.8.1 (mangle) | 175.33 ms ( 9.3 <) | |
|
|
+-----------------------+-----------------------+----------------------+
|
|
| |rjsmin| | 6.99 ms (11.6 =) | |
|
|
+-----------------------+-----------------------+----------------------+
|
|
| _\ |rjsmin| | 0.08 ms (11.6 =) | |
|
|
+-----------------------+-----------------------+----------------------+
|
|
|
|
|
|
.. vim: ft=rest tw=72
|