Nickle's performance appears to be around 5 times slower
than equivalent C code using the GNU GMP multiple-precision library,
and quite a bit faster than GNU bc. Some simple
benchmarks were run to compare the performance of Nickle
1.99.3, GNU bc 1.05, and C using GNU GMP 2.0.
Four benchmarks were utilized: rfact
computes using the
obvious recursive implementation, ifact
computes
iteratively, choose computes
(using ifact in the C and bc
versions), and comp applies the Miller-Rabin
test to the prime number
for every possible base
from
to
. (The source of all of these
benchmarks is available with the Nickle distribution.)
Table 1 shows Nickle execution times on an Athlon
700 with 256MB of RAM
running Linux kernel 2.4.1
in
single-user mode. All times are the
minimum of 5 insignificantly different consecutive runs.
(Nickle's built-in operator, while more convenient,
produced similar timings to the hand-coded versions.)
Nickle and GMP spent about 50% of total time
on the factorial benchmarks generating and printing
the decimal result (since there appears to be no easy way to
inhibit this behavior in bc). The runtimes for these
benchmarks are thus somewhat inflated.
In general, the performance
results are positive: the small performance hit over C code is more than
made up for in ease of use.