[REBOL] Re: byte frequencies
From: joel:neely:fedex at: 6-Jul-2001 23:17
Jeff Kreis wrote:
> I think benchmarks that involve performance impacted by
> potential page faults are more meaningful when accompanied
> by the test system memory stats (available system ram, etc.)
>
Good point. Another reason for doing so is that I've found a
few cases where relative benchmarks give different results on
different platforms.
I ran these on PentiumII, 108Mb RAM, RedHat 7.1, View 1.2.0.4.2.
I typically check for performance issues separately from running
the timings, to minimize Heisenberg, but re-ran a few checks for
the following.
Via another xterm during the 8Mb test, top showed rebol using
90%-95% CPU, 7.5% of memory, with over 13Mb mem free and swap
doing basically nothing. Most of the time there were 2-4
processes running (REBOL, top, X, and xterm, in that order).
Rerunning the tests with that extra load increased the wall time
by a few percent, but the relative performances of the three
versions stayed consistent with the earlier figures.
There's no rocket science here at all, but if anyone is curious
enough to run identical tests on other platforms, the test rig
was (function bodies deleted for space, they're in the earlier
post):
charfreq: make object! [
totdir: array/initial 256 0
totcpy: array/initial 256 0
totbuf: array/initial 256 0
cfdir: func [fn [file!] /local fi ch] [...]
cfcpy: func [fn [file!] /local fi mybuf ch] [...]
cfbuf: func [fn [file!] /local ch] [...]
timetest: func [fn [file!] n [integer!] /local t0 t1 t2] [
t0: now/time
loop n [cfdir fn]
t1: now/time
loop n [cfcpy fn]
t2: now/time
loop n [cfbuf fn]
t3: now/time
t3: t3 - t2
t3: t3/hour * 60 + t3/minute * 60 + t3/second
t2: t2 - t1
t2: t2/hour * 60 + t2/minute * 60 + t2/second
t1: t1 - t0
t1: t1/hour * 60 + t1/minute * 60 + t1/second
t0: min min t1 t2 t3
print [
t1 tab t1 / t0 newline
t2 tab t2 / t0 newline
t3 tab t3 / t0 newline
]
]
]
The second parameter N to CHARFREQ/TIMETEST can be left at 1
if you have a large enough file (or a slow enough CPU! ;-)
-jn-
--
---------------------------------------------------------------
There are two types of science: physics and stamp collecting!
-- Sir Arthur Eddington
joel-dot-neely-at-fedex-dot-com