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 docs/BENCHMARKS file in the source distribution contains a more comprehensive list. Said that - there is a considerable speed up of the python-only ports to be observed with Python 3.11. Thatswhy the benchmark will list all Python 3 versions up to 3.10.

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 [1]. The sign behind the size value denotes the size difference in relation to the simple port (i.e. jsmin itself).

Python 3.13.0

Name

apiviewer (953.2)

bootstrap (49.0)

Simple Port

398.06 ms (951.5 *)

18.18 ms (26.4 *)

jsmin 2.0.9

819.37 ms (951.5 >)

11.91 ms (26.4 >)

rJSmin

27.59 ms (951.5 =)

6.50 ms (26.4 >)

_rJSmin

2.91 ms (951.5 =)

0.13 ms (26.4 >)

Name

DateTimeShortcuts (18.3)

jquery (242.4)

Simple Port

6.88 ms (10.2 *)

96.47 ms (135.9 *)

jsmin 2.0.9

4.58 ms (10.3 >)

79.07 ms (136.8 >)

rJSmin

1.71 ms (10.2 >)

42.41 ms (135.9 =)

_rJSmin

0.04 ms (10.2 >)

0.85 ms (135.9 =)

Name

knockout (38.9)

markermanager (28.6)

Simple Port

16.00 ms (38.6 *)

9.08 ms (11.6 *)

jsmin 2.0.9

12.73 ms (38.6 >)

6.13 ms (11.6 >)

rJSmin

1.35 ms (38.6 >)

2.68 ms (11.6 =)

_rJSmin

0.08 ms (38.6 >)

0.06 ms (11.6 =)

Python 3.12.7

Name

apiviewer (953.2)

bootstrap (49.0)

Simple Port

348.35 ms (951.5 *)

16.43 ms (26.4 *)

jsmin 2.0.9

766.34 ms (951.5 >)

10.40 ms (26.4 >)

rJSmin

28.86 ms (951.5 =)

6.52 ms (26.4 >)

_rJSmin

2.94 ms (951.5 =)

0.14 ms (26.4 >)

Name

DateTimeShortcuts (18.3)

jquery (242.4)

Simple Port

6.32 ms (10.2 *)

86.12 ms (135.9 *)

jsmin 2.0.9

4.01 ms (10.3 >)

71.07 ms (136.8 >)

rJSmin

2.08 ms (10.2 >)

43.50 ms (135.9 =)

_rJSmin

0.04 ms (10.2 >)

0.88 ms (135.9 =)

Name

knockout (38.9)

markermanager (28.6)

Simple Port

14.22 ms (38.6 *)

8.46 ms (11.6 *)

jsmin 2.0.9

10.77 ms (38.6 >)

5.58 ms (11.6 >)

rJSmin

1.41 ms (38.6 >)

3.53 ms (11.6 =)

_rJSmin

0.08 ms (38.6 >)

0.06 ms (11.6 =)

Python 3.11.10

Name

apiviewer (953.2)

bootstrap (49.0)

Simple Port

481.04 ms (951.5 *)

18.67 ms (26.4 *)

jsmin 2.0.9

814.00 ms (951.5 >)

11.07 ms (26.4 >)

rJSmin

27.42 ms (951.5 =)

6.13 ms (26.4 >)

_rJSmin

2.90 ms (951.5 =)

0.13 ms (26.4 >)

Name

DateTimeShortcuts (18.3)

jquery (242.4)

Simple Port

7.00 ms (10.2 *)

98.81 ms (135.9 *)

jsmin 2.0.9

4.29 ms (10.3 >)

74.70 ms (136.8 >)

rJSmin

1.62 ms (10.2 >)

39.73 ms (135.9 =)

_rJSmin

0.04 ms (10.2 >)

0.87 ms (135.9 =)

Name

knockout (38.9)

markermanager (28.6)

Simple Port

16.59 ms (38.6 *)

9.20 ms (11.6 *)

jsmin 2.0.9

11.75 ms (38.6 >)

5.67 ms (11.6 >)

rJSmin

1.28 ms (38.6 >)

2.73 ms (11.6 =)

_rJSmin

0.08 ms (38.6 >)

0.06 ms (11.6 =)

Python 3.10.15

Name

apiviewer (953.2)

bootstrap (49.0)

Simple Port

1008.40 ms (951.5 *)

42.56 ms (26.4 *)

jsmin 2.0.9

932.13 ms (951.5 >)

16.69 ms (26.4 >)

rJSmin

30.07 ms (951.5 =)

7.43 ms (26.4 >)

_rJSmin

3.23 ms (951.5 =)

0.15 ms (26.4 >)

Name

DateTimeShortcuts (18.3)

jquery (242.4)

Simple Port

15.97 ms (10.2 *)

223.00 ms (135.9 *)

jsmin 2.0.9

6.57 ms (10.3 >)

103.68 ms (136.8 >)

rJSmin

2.13 ms (10.2 >)

48.03 ms (135.9 =)

_rJSmin

0.04 ms (10.2 >)

0.87 ms (135.9 =)

Name

knockout (38.9)

markermanager (28.6)

Simple Port

40.41 ms (38.6 *)

21.09 ms (11.6 *)

jsmin 2.0.9

18.20 ms (38.6 >)

8.62 ms (11.6 >)

rJSmin

1.75 ms (38.6 >)

3.24 ms (11.6 =)

_rJSmin

0.08 ms (38.6 >)

0.06 ms (11.6 =)

Python 2.7.18

Name

apiviewer (953.2)

bootstrap (49.0)

Simple Port

1227.72 ms (951.5 *)

49.81 ms (26.4 *)

jsmin 2.0.9

1129.07 ms (951.5 >)

21.14 ms (26.4 >)

rJSmin

29.17 ms (951.5 =)

7.23 ms (26.4 >)

_rJSmin

2.34 ms (951.5 =)

0.14 ms (26.4 >)

Name

DateTimeShortcuts (18.3)

jquery (242.4)

Simple Port

18.44 ms (10.2 *)

257.42 ms (135.9 *)

jsmin 2.0.9

7.97 ms (10.3 >)

131.19 ms (136.8 >)

rJSmin

1.90 ms (10.2 >)

49.17 ms (135.9 =)

_rJSmin

0.04 ms (10.2 >)

0.88 ms (135.9 =)

Name

knockout (38.9)

markermanager (28.6)

Simple Port

49.81 ms (38.6 *)

24.48 ms (11.6 *)

jsmin 2.0.9

23.67 ms (38.6 >)

10.74 ms (11.6 >)

rJSmin

1.48 ms (38.6 >)

3.01 ms (11.6 =)

_rJSmin

0.10 ms (38.6 >)

0.07 ms (11.6 =)