166 lines
6.9 KiB
Plaintext
166 lines
6.9 KiB
Plaintext
.. copyright:
|
|
Copyright 2011 - 2015
|
|
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. 3.3 vs 3.4), 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]).
|
|
|
|
|**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
|
|
- DateTimeShortcuts is part of the Django admin interface (1.8.5)
|
|
- 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.5.0
|
|
~~~~~~~~~~~~
|
|
|
|
.. rst-class:: benchmark
|
|
|
|
+-------------+--------------------------+-----------------------+
|
|
| Name | apiviewer (953.2) | bootstrap (49.0) |
|
|
+=============+==========================+=======================+
|
|
| Simple Port | 2519.02 ms (951.5 \*) | 105.18 ms (26.4 \*) |
|
|
+-------------+--------------------------+-----------------------+
|
|
| jsmin 2.0.9 | 3794.39 ms (951.5 >) | 44.32 ms (26.4 >) |
|
|
+-------------+--------------------------+-----------------------+
|
|
| |rjsmin| | 79.16 ms (951.5 =) | 19.51 ms (26.4 >) |
|
|
+-------------+--------------------------+-----------------------+
|
|
| _\ |rjsmin| | 3.30 ms (951.5 =) | 0.21 ms (26.4 >) |
|
|
+-------------+--------------------------+-----------------------+
|
|
|
|
.. rst-class:: benchmark
|
|
|
|
+-------------+--------------------------+-----------------------+
|
|
| Name | DateTimeShortcuts (18.3) | jquery (242.4) |
|
|
+=============+==========================+=======================+
|
|
| Simple Port | 40.56 ms (10.2 \*) | 557.08 ms (135.9 \*) |
|
|
+-------------+--------------------------+-----------------------+
|
|
| jsmin 2.0.9 | 16.29 ms (10.3 >) | 328.83 ms (136.8 >) |
|
|
+-------------+--------------------------+-----------------------+
|
|
| |rjsmin| | 5.22 ms (10.2 >) | 134.97 ms (135.9 =) |
|
|
+-------------+--------------------------+-----------------------+
|
|
| _\ |rjsmin| | 0.07 ms (10.2 >) | 1.26 ms (135.9 =) |
|
|
+-------------+--------------------------+-----------------------+
|
|
|
|
.. rst-class:: benchmark
|
|
|
|
+-------------+--------------------------+-----------------------+
|
|
| Name | knockout (38.9) | markermanager (28.6) |
|
|
+=============+==========================+=======================+
|
|
| Simple Port | 100.17 ms (38.6 \*) | 51.73 ms (11.6 \*) |
|
|
+-------------+--------------------------+-----------------------+
|
|
| jsmin 2.0.9 | 48.00 ms (38.6 >) | 21.41 ms (11.6 >) |
|
|
+-------------+--------------------------+-----------------------+
|
|
| |rjsmin| | 4.35 ms (38.6 >) | 8.33 ms (11.6 =) |
|
|
+-------------+--------------------------+-----------------------+
|
|
| _\ |rjsmin| | 0.14 ms (38.6 >) | 0.10 ms (11.6 =) |
|
|
+-------------+--------------------------+-----------------------+
|
|
|
|
|
|
Python 2.7.10
|
|
~~~~~~~~~~~~~
|
|
|
|
.. rst-class:: benchmark
|
|
|
|
+-------------+--------------------------+-----------------------+
|
|
| Name | apiviewer (953.2) | bootstrap (49.0) |
|
|
+=============+==========================+=======================+
|
|
| Simple Port | 3702.75 ms (951.5 \*) | 146.47 ms (26.4 \*) |
|
|
+-------------+--------------------------+-----------------------+
|
|
| jsmin 2.0.9 | 5179.05 ms (951.5 >) | 65.03 ms (26.4 >) |
|
|
+-------------+--------------------------+-----------------------+
|
|
| |rjsmin| | 68.60 ms (951.5 =) | 17.23 ms (26.4 >) |
|
|
+-------------+--------------------------+-----------------------+
|
|
| _\ |rjsmin| | 2.84 ms (951.5 =) | 0.20 ms (26.4 >) |
|
|
+-------------+--------------------------+-----------------------+
|
|
|
|
.. rst-class:: benchmark
|
|
|
|
+-------------+--------------------------+-----------------------+
|
|
| Name | DateTimeShortcuts (18.3) | jquery (242.4) |
|
|
+=============+==========================+=======================+
|
|
| Simple Port | 55.36 ms (10.2 \*) | 774.19 ms (135.9 \*) |
|
|
+-------------+--------------------------+-----------------------+
|
|
| jsmin 2.0.9 | 23.73 ms (10.3 >) | 473.82 ms (136.8 >) |
|
|
+-------------+--------------------------+-----------------------+
|
|
| |rjsmin| | 4.64 ms (10.2 >) | 121.01 ms (135.9 =) |
|
|
+-------------+--------------------------+-----------------------+
|
|
| _\ |rjsmin| | 0.06 ms (10.2 >) | 1.16 ms (135.9 =) |
|
|
+-------------+--------------------------+-----------------------+
|
|
|
|
.. rst-class:: benchmark
|
|
|
|
+-------------+--------------------------+-----------------------+
|
|
| Name | knockout (38.9) | markermanager (28.6) |
|
|
+=============+==========================+=======================+
|
|
| Simple Port | 148.60 ms (38.6 \*) | 71.61 ms (11.6 \*) |
|
|
+-------------+--------------------------+-----------------------+
|
|
| jsmin 2.0.9 | 72.83 ms (38.6 >) | 32.29 ms (11.6 >) |
|
|
+-------------+--------------------------+-----------------------+
|
|
| |rjsmin| | 3.87 ms (38.6 >) | 7.47 ms (11.6 =) |
|
|
+-------------+--------------------------+-----------------------+
|
|
| _\ |rjsmin| | 0.12 ms (38.6 >) | 0.09 ms (11.6 =) |
|
|
+-------------+--------------------------+-----------------------+
|
|
|
|
.. end tables
|
|
|
|
|
|
.. vim: ft=rest tw=72
|