Debian Codegraph @

docs/_userdoc/benchmark.txt

raw
1 .. copyright:
2 Copyright 2011 - 2025
3 André Malo or his licensors, as applicable
4
5 .. license:
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9
10 http://www.apache.org/licenses/LICENSE-2.0
11
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
17
18 :orphan:
19
20
21 ====================
22 rJSmin - Benchmark
23 ====================
24
25 .. xxcontents::
26 :local:
27
28
29 The following numbers have been measured with the bench package provided
30 in the source distribution. Since the numbers don't vary much between
31 python minor releases (e.g. 3.3 vs 3.4), only one benchmark per major
32 version is given below. The :file:`docs/BENCHMARKS` file in the source
33 distribution contains a more comprehensive list.
34 Said that - there is a considerable speed up of the python-only ports to
35 be observed with Python 3.11. Thatswhy the benchmark will list all
36 Python 3 versions up to 3.10.
37
38 Here's the list of benchmarked implementations:
39
40 **Simple port**
41 The original jsmin.py port by Baruch Even
42
43 **jsmin 2.0.9**
44 A speed-refactored python port by Dave St.Germain. There are some
45 spikes in lower Python 3 versions (especially for the big file
46 [apiviewer.js]).
47
48 |**rjsmin**|
49 this very project
50
51 **_**\ |**rjsmin**|
52 The C reimplementation of |rjsmin|
53
54 Note that the various implementations produce output different from the
55 original jsmin.c for one reason or another. Also the simple port was
56 modified to use ``cStringIO`` if available (it's faster then) or io (for
57 python 3).
58
59 And here's a list of the benchmarked javascript files:
60
61 - apiviewer is a file from the qooxdoo framework. Very big and already
62 compressed.
63 - bootstrap is the popular twitter toolkit, version 2.0.4
64 - DateTimeShortcuts is part of the Django admin interface (1.8.5)
65 - jquery is jquery-1.7.1.js; the uncompressed development download.
66 - knockout is knockout-2.0.0.js, the compressed download.
67 - markermanager is the V3 port of the google maps markermanager.
68
69 Inside the parentheses are size information in KiB [#]_\. The sign
70 behind the size value denotes the size difference in relation to the
71 simple port (i.e. jsmin itself).
72
73 .. [#] Bytes / 1024 for Python 2 and Code Points / 1024 for Python 3
74
75
76 .. begin tables
77
78 Python 3.14.0
79 ~~~~~~~~~~~~~
80
81 .. rst-class:: benchmark
82
83 +-------------+--------------------------+-----------------------+
84 | Name | apiviewer (953.2) | bootstrap (49.0) |
85 +=============+==========================+=======================+
86 | Simple Port | 394.29 ms (951.5 \*) | 18.07 ms (26.4 \*) |
87 +-------------+--------------------------+-----------------------+
88 | jsmin 2.0.9 | 817.36 ms (951.5 >) | 12.06 ms (26.4 >) |
89 +-------------+--------------------------+-----------------------+
90 | |rjsmin| | 26.57 ms (951.5 =) | 6.10 ms (26.4 >) |
91 +-------------+--------------------------+-----------------------+
92 | _\ |rjsmin| | 2.67 ms (951.5 =) | 0.11 ms (26.4 >) |
93 +-------------+--------------------------+-----------------------+
94
95 .. rst-class:: benchmark
96
97 +-------------+--------------------------+-----------------------+
98 | Name | DateTimeShortcuts (18.3) | jquery (242.4) |
99 +=============+==========================+=======================+
100 | Simple Port | 6.71 ms (10.2 \*) | 96.35 ms (135.9 \*) |
101 +-------------+--------------------------+-----------------------+
102 | jsmin 2.0.9 | 4.62 ms (10.3 >) | 79.81 ms (136.8 >) |
103 +-------------+--------------------------+-----------------------+
104 | |rjsmin| | 1.67 ms (10.2 >) | 41.28 ms (135.9 =) |
105 +-------------+--------------------------+-----------------------+
106 | _\ |rjsmin| | 0.03 ms (10.2 >) | 0.75 ms (135.9 =) |
107 +-------------+--------------------------+-----------------------+
108
109 .. rst-class:: benchmark
110
111 +-------------+--------------------------+-----------------------+
112 | Name | knockout (38.9) | markermanager (28.6) |
113 +=============+==========================+=======================+
114 | Simple Port | 15.86 ms (38.6 \*) | 8.93 ms (11.6 \*) |
115 +-------------+--------------------------+-----------------------+
116 | jsmin 2.0.9 | 12.69 ms (38.6 >) | 6.22 ms (11.6 >) |
117 +-------------+--------------------------+-----------------------+
118 | |rjsmin| | 1.37 ms (38.6 >) | 2.58 ms (11.6 =) |
119 +-------------+--------------------------+-----------------------+
120 | _\ |rjsmin| | 0.06 ms (38.6 >) | 0.05 ms (11.6 =) |
121 +-------------+--------------------------+-----------------------+
122
123
124 Python 3.13.5
125 ~~~~~~~~~~~~~
126
127 .. rst-class:: benchmark
128
129 +-------------+--------------------------+-----------------------+
130 | Name | apiviewer (953.2) | bootstrap (49.0) |
131 +=============+==========================+=======================+
132 | Simple Port | 387.62 ms (951.5 \*) | 19.26 ms (26.4 \*) |
133 +-------------+--------------------------+-----------------------+
134 | jsmin 2.0.9 | 837.34 ms (951.5 >) | 13.16 ms (26.4 >) |
135 +-------------+--------------------------+-----------------------+
136 | |rjsmin| | 26.38 ms (951.5 =) | 6.79 ms (26.4 >) |
137 +-------------+--------------------------+-----------------------+
138 | _\ |rjsmin| | 3.11 ms (951.5 =) | 0.14 ms (26.4 >) |
139 +-------------+--------------------------+-----------------------+
140
141 .. rst-class:: benchmark
142
143 +-------------+--------------------------+-----------------------+
144 | Name | DateTimeShortcuts (18.3) | jquery (242.4) |
145 +=============+==========================+=======================+
146 | Simple Port | 7.42 ms (10.2 \*) | 97.24 ms (135.9 \*) |
147 +-------------+--------------------------+-----------------------+
148 | jsmin 2.0.9 | 5.27 ms (10.3 >) | 80.16 ms (136.8 >) |
149 +-------------+--------------------------+-----------------------+
150 | |rjsmin| | 2.33 ms (10.2 >) | 41.29 ms (135.9 =) |
151 +-------------+--------------------------+-----------------------+
152 | _\ |rjsmin| | 0.04 ms (10.2 >) | 0.84 ms (135.9 =) |
153 +-------------+--------------------------+-----------------------+
154
155 .. rst-class:: benchmark
156
157 +-------------+--------------------------+-----------------------+
158 | Name | knockout (38.9) | markermanager (28.6) |
159 +=============+==========================+=======================+
160 | Simple Port | 16.63 ms (38.6 \*) | 9.75 ms (11.6 \*) |
161 +-------------+--------------------------+-----------------------+
162 | jsmin 2.0.9 | 13.50 ms (38.6 >) | 6.32 ms (11.6 >) |
163 +-------------+--------------------------+-----------------------+
164 | |rjsmin| | 1.61 ms (38.6 >) | 2.62 ms (11.6 =) |
165 +-------------+--------------------------+-----------------------+
166 | _\ |rjsmin| | 0.08 ms (38.6 >) | 0.06 ms (11.6 =) |
167 +-------------+--------------------------+-----------------------+
168
169
170 Python 3.12.11
171 ~~~~~~~~~~~~~~
172
173 .. rst-class:: benchmark
174
175 +-------------+--------------------------+-----------------------+
176 | Name | apiviewer (953.2) | bootstrap (49.0) |
177 +=============+==========================+=======================+
178 | Simple Port | 349.42 ms (951.5 \*) | 16.92 ms (26.4 \*) |
179 +-------------+--------------------------+-----------------------+
180 | jsmin 2.0.9 | 791.10 ms (951.5 >) | 10.77 ms (26.4 >) |
181 +-------------+--------------------------+-----------------------+
182 | |rjsmin| | 27.54 ms (951.5 =) | 6.09 ms (26.4 >) |
183 +-------------+--------------------------+-----------------------+
184 | _\ |rjsmin| | 3.08 ms (951.5 =) | 0.13 ms (26.4 >) |
185 +-------------+--------------------------+-----------------------+
186
187 .. rst-class:: benchmark
188
189 +-------------+--------------------------+-----------------------+
190 | Name | DateTimeShortcuts (18.3) | jquery (242.4) |
191 +=============+==========================+=======================+
192 | Simple Port | 6.64 ms (10.2 \*) | 86.83 ms (135.9 \*) |
193 +-------------+--------------------------+-----------------------+
194 | jsmin 2.0.9 | 4.16 ms (10.3 >) | 72.62 ms (136.8 >) |
195 +-------------+--------------------------+-----------------------+
196 | |rjsmin| | 1.63 ms (10.2 >) | 40.38 ms (135.9 =) |
197 +-------------+--------------------------+-----------------------+
198 | _\ |rjsmin| | 0.04 ms (10.2 >) | 0.84 ms (135.9 =) |
199 +-------------+--------------------------+-----------------------+
200
201 .. rst-class:: benchmark
202
203 +-------------+--------------------------+-----------------------+
204 | Name | knockout (38.9) | markermanager (28.6) |
205 +=============+==========================+=======================+
206 | Simple Port | 14.45 ms (38.6 \*) | 8.12 ms (11.6 \*) |
207 +-------------+--------------------------+-----------------------+
208 | jsmin 2.0.9 | 12.13 ms (38.6 >) | 5.72 ms (11.6 >) |
209 +-------------+--------------------------+-----------------------+
210 | |rjsmin| | 1.32 ms (38.6 >) | 2.59 ms (11.6 =) |
211 +-------------+--------------------------+-----------------------+
212 | _\ |rjsmin| | 0.08 ms (38.6 >) | 0.06 ms (11.6 =) |
213 +-------------+--------------------------+-----------------------+
214
215
216 Python 3.11.13
217 ~~~~~~~~~~~~~~
218
219 .. rst-class:: benchmark
220
221 +-------------+--------------------------+-----------------------+
222 | Name | apiviewer (953.2) | bootstrap (49.0) |
223 +=============+==========================+=======================+
224 | Simple Port | 467.72 ms (951.5 \*) | 18.40 ms (26.4 \*) |
225 +-------------+--------------------------+-----------------------+
226 | jsmin 2.0.9 | 804.45 ms (951.5 >) | 11.18 ms (26.4 >) |
227 +-------------+--------------------------+-----------------------+
228 | |rjsmin| | 27.01 ms (951.5 =) | 6.80 ms (26.4 >) |
229 +-------------+--------------------------+-----------------------+
230 | _\ |rjsmin| | 2.86 ms (951.5 =) | 0.11 ms (26.4 >) |
231 +-------------+--------------------------+-----------------------+
232
233 .. rst-class:: benchmark
234
235 +-------------+--------------------------+-----------------------+
236 | Name | DateTimeShortcuts (18.3) | jquery (242.4) |
237 +=============+==========================+=======================+
238 | Simple Port | 7.34 ms (10.2 \*) | 96.61 ms (135.9 \*) |
239 +-------------+--------------------------+-----------------------+
240 | jsmin 2.0.9 | 4.54 ms (10.3 >) | 75.03 ms (136.8 >) |
241 +-------------+--------------------------+-----------------------+
242 | |rjsmin| | 1.67 ms (10.2 >) | 40.64 ms (135.9 =) |
243 +-------------+--------------------------+-----------------------+
244 | _\ |rjsmin| | 0.03 ms (10.2 >) | 0.78 ms (135.9 =) |
245 +-------------+--------------------------+-----------------------+
246
247 .. rst-class:: benchmark
248
249 +-------------+--------------------------+-----------------------+
250 | Name | knockout (38.9) | markermanager (28.6) |
251 +=============+==========================+=======================+
252 | Simple Port | 16.60 ms (38.6 \*) | 8.89 ms (11.6 \*) |
253 +-------------+--------------------------+-----------------------+
254 | jsmin 2.0.9 | 11.72 ms (38.6 >) | 5.63 ms (11.6 >) |
255 +-------------+--------------------------+-----------------------+
256 | |rjsmin| | 1.29 ms (38.6 >) | 2.75 ms (11.6 =) |
257 +-------------+--------------------------+-----------------------+
258 | _\ |rjsmin| | 0.06 ms (38.6 >) | 0.05 ms (11.6 =) |
259 +-------------+--------------------------+-----------------------+
260
261
262 Python 3.10.18
263 ~~~~~~~~~~~~~~
264
265 .. rst-class:: benchmark
266
267 +-------------+--------------------------+-----------------------+
268 | Name | apiviewer (953.2) | bootstrap (49.0) |
269 +=============+==========================+=======================+
270 | Simple Port | 999.11 ms (951.5 \*) | 42.25 ms (26.4 \*) |
271 +-------------+--------------------------+-----------------------+
272 | jsmin 2.0.9 | 936.70 ms (951.5 >) | 16.13 ms (26.4 >) |
273 +-------------+--------------------------+-----------------------+
274 | |rjsmin| | 30.85 ms (951.5 =) | 7.20 ms (26.4 >) |
275 +-------------+--------------------------+-----------------------+
276 | _\ |rjsmin| | 2.87 ms (951.5 =) | 0.11 ms (26.4 >) |
277 +-------------+--------------------------+-----------------------+
278
279 .. rst-class:: benchmark
280
281 +-------------+--------------------------+-----------------------+
282 | Name | DateTimeShortcuts (18.3) | jquery (242.4) |
283 +=============+==========================+=======================+
284 | Simple Port | 15.67 ms (10.2 \*) | 221.41 ms (135.9 \*) |
285 +-------------+--------------------------+-----------------------+
286 | jsmin 2.0.9 | 6.16 ms (10.3 >) | 101.67 ms (136.8 >) |
287 +-------------+--------------------------+-----------------------+
288 | |rjsmin| | 1.90 ms (10.2 >) | 47.53 ms (135.9 =) |
289 +-------------+--------------------------+-----------------------+
290 | _\ |rjsmin| | 0.03 ms (10.2 >) | 0.75 ms (135.9 =) |
291 +-------------+--------------------------+-----------------------+
292
293 .. rst-class:: benchmark
294
295 +-------------+--------------------------+-----------------------+
296 | Name | knockout (38.9) | markermanager (28.6) |
297 +=============+==========================+=======================+
298 | Simple Port | 39.99 ms (38.6 \*) | 20.89 ms (11.6 \*) |
299 +-------------+--------------------------+-----------------------+
300 | jsmin 2.0.9 | 17.34 ms (38.6 >) | 8.31 ms (11.6 >) |
301 +-------------+--------------------------+-----------------------+
302 | |rjsmin| | 1.47 ms (38.6 >) | 3.03 ms (11.6 =) |
303 +-------------+--------------------------+-----------------------+
304 | _\ |rjsmin| | 0.06 ms (38.6 >) | 0.05 ms (11.6 =) |
305 +-------------+--------------------------+-----------------------+
306
307
308 Python 2.7.18
309 ~~~~~~~~~~~~~
310
311 .. rst-class:: benchmark
312
313 +-------------+--------------------------+-----------------------+
314 | Name | apiviewer (953.2) | bootstrap (49.0) |
315 +=============+==========================+=======================+
316 | Simple Port | 1239.53 ms (951.5 \*) | 50.12 ms (26.4 \*) |
317 +-------------+--------------------------+-----------------------+
318 | jsmin 2.0.9 | 1136.84 ms (951.5 >) | 21.57 ms (26.4 >) |
319 +-------------+--------------------------+-----------------------+
320 | |rjsmin| | 28.64 ms (951.5 =) | 7.49 ms (26.4 >) |
321 +-------------+--------------------------+-----------------------+
322 | _\ |rjsmin| | 1.75 ms (951.5 =) | 0.12 ms (26.4 >) |
323 +-------------+--------------------------+-----------------------+
324
325 .. rst-class:: benchmark
326
327 +-------------+--------------------------+-----------------------+
328 | Name | DateTimeShortcuts (18.3) | jquery (242.4) |
329 +=============+==========================+=======================+
330 | Simple Port | 18.67 ms (10.2 \*) | 260.30 ms (135.9 \*) |
331 +-------------+--------------------------+-----------------------+
332 | jsmin 2.0.9 | 8.12 ms (10.3 >) | 134.42 ms (136.8 >) |
333 +-------------+--------------------------+-----------------------+
334 | |rjsmin| | 1.96 ms (10.2 >) | 49.72 ms (135.9 =) |
335 +-------------+--------------------------+-----------------------+
336 | _\ |rjsmin| | 0.03 ms (10.2 >) | 0.79 ms (135.9 =) |
337 +-------------+--------------------------+-----------------------+
338
339 .. rst-class:: benchmark
340
341 +-------------+--------------------------+-----------------------+
342 | Name | knockout (38.9) | markermanager (28.6) |
343 +=============+==========================+=======================+
344 | Simple Port | 49.72 ms (38.6 \*) | 24.99 ms (11.6 \*) |
345 +-------------+--------------------------+-----------------------+
346 | jsmin 2.0.9 | 24.07 ms (38.6 >) | 10.89 ms (11.6 >) |
347 +-------------+--------------------------+-----------------------+
348 | |rjsmin| | 1.51 ms (38.6 >) | 3.13 ms (11.6 =) |
349 +-------------+--------------------------+-----------------------+
350 | _\ |rjsmin| | 0.07 ms (38.6 >) | 0.05 ms (11.6 =) |
351 +-------------+--------------------------+-----------------------+
352
353 .. end tables
354
355
356 .. vim: ft=rest tw=72