[REBOL] Small admin/report benchmark Re:(2)
From: joel:neely:fedex at: 23-Sep-2000 0:05
The following are results from the latest round of benchmarking, with
all numbers normalized to the measurements for nsh.r (the first,
straight-forward, no-optimization-tricks version I wrote). I'm using
that one as 1.0 because I believe it to represent the kind of code
a not-too-subtle REBOL programmer would write. The other versions
submitted to the list represent improvements on its performance (in
general ;-).
First, some results -- remember that these are all ratios relative
to nsh.r (where smaller numbers mean less resources used, ergo
better performance); this table is in order from smallest to highest
run time.
Version User System Elapsed Page Faults Swaps
Time Time Time Major Minor
nsh.pl 0.53 0.06 0.51 0.08 0.00 0.00
gabrsh.r 0.70 0.24 0.68 0.05 0.06 0.00
ladsh2.r 0.84 0.24 0.81 0.07 0.06 0.00
nsh.r 1.00 1.00 1.00 1.00 1.00 1.00
jeffsh.r 3.50 27.30 4.63 1.88 124.67 370.95
jeffsh2.r 3.47 27.39 4.63 2.00 124.68 368.09
Gabriele's version comes closes to hiting Perl's performance across
the board. Ladislav's comes next (this is the second script he
posted; the first one blew up on my box repeatedly). The only
modification to his post was to delete the REBOL-based timing
code. I'm doing the benchmark with the 'nix/'nux time command.
As for Jeff's...
First, I had to comment out all of the code that was specific to
/View and replace it with equivalent code. (I needed /Core
syntax, and needed to run it in the same fashion as the others,
in order to keep the apples-to-apples comparison.
Second, the cost of building up a block with all of the
occurrences of each shell's name (as the value corresponding to
that name) clearly poses a high memory demand.
Third, I also added sorting back in (sorry, Jeff, but I wanted
an apples-to-apples comparison) to both versions: jeffsh.r sorts
the name/counts block at the end, while jeffsh2.r sorts the
name/copy-per-occurrence block prior to grabbing the counts. The
fact that the times are so close together (despite the wildly-
varying amount of data in the blocks being sorted) tells me that
RT did The Right Thing in their block sorting algorithm!
Since there was some variation in the timings, and I wanted to
have stable statistics, I ran each version at least four times,
then averaged the statistics for the last three runs of each
version. For those who want to see the raw numbers, here they
are. The table contains the actual statistics for the three runs
used, along with their averages, in the order that I ran them:
Version User System Elapsed Page Faults Swaps
(by) Time Time Time Major Minor
nsh.pl 36.72 0.22 37.09 258 48 0
(Joel) 36.69 0.21 37.02 258 48 0
36.81 0.13 37.06 258 48 0
----- ----- ----- ------- ---------- -------
36.74 0.19 37.06 258 48 0
nsh.r 69.04 3.52 73.09 3474 12170 0
(Joel) 69.06 3.4 73.04 3335 12170 0
68.92 3.34 72.89 3087 12174 14
----- ----- ----- ------- ---------- -------
69.01 3.42 73.01 3298.67 12171.33 4.67
gabrsh.r 48.81 0.8 50.2 168 707 0
(Gabriele) 48.51 0.82 49.89 167 707 0
48.52 0.8 49.86 167 707 0
----- ----- ----- ------- ---------- -------
48.61 0.81 49.98 167.33 707 0
jeffsh.r 240.91 94.55 338.88 6507 1517519 1771
(Jeff) 241.81 92.69 337.96 6282 1517751 1934
241.07 92.86 337.16 5846 1517091 1492
----- ----- ------ ------- ---------- -------
241.26 93.37 338 6211.67 1517453.67 1732.33
jeffsh2.r 241.39 92.25 343.21 9474 1519216 3295
(Jeff) 237.36 93.89 332.03 3521 1515836 0
240.12 94.9 338.15 6751 1517381 1862
----- ----- ----- ------- ---------- -------
239.62 93.68 337.8 6582 1517477.67 1719
ladsh2.r 58.56 0.77 59.50 342 707 0
(Ladislav) 57.45 0.90 58.91 167 707 0
57.43 0.78 58.74 167 707 0
----- ----- ----- ---- ------- -------
57.81 0.82 59.05 225.33 707 0
Clearly, reading a large input file a line at a time helps run
speed considerably!
-jn-