Hi Tomas,

it may be a bit late by now, but I'd like to write some comments about
your posting last year, concerning bignum performance.


On Thu, Oct 16, 2008 at 11:57:07AM +0100, Tomas Hlavaty wrote:
> I was curious to try picolisp bignums and must say that for somebody
> doing anything serious, it is probably rather inefficient.
> ...
> (<= N 100000)
> 
> $ time ~/picolisp/p gmp-test2.l -bye > gmp-test2.log
> 
> real  0m10.190s
> user  0m10.157s
> sys       0m0.008s


Now I tried it here:

   $ time bin/picolisp gmp-test2.l >/dev/null
   real    0m11.938s
   user    0m11.780s
   sys     0m0.160s

As you see, with roughly the same result.


However, I am aware of the fact that in picoLisp the printing of numeric
results is often much more expensive than the actual calculations, due
to the conversions necessary for the decimal base.

If I take out the final (prinl Y) from gmp-test2.l, I get:

   $ time bin/picolisp gmp-test2.l
   real    0m3.326s
   user    0m3.200s
   sys     0m0.130s

It makes a considerable difference.



> (<= N 1000000)
> 
> $ time ~/picolisp/p gmp-test2.l -bye > gmp-test2.log
>   C-c C-cKilled
> 
> real  17m58.856s
> user  17m51.687s
> sys       0m5.572s
> 
> (killed after 18 mins!)

Now if I also use 1000000 iterations (but without the printing to save
time), I get:

   $ time bin/picolisp gmp-test2.l
   real    5m4.904s
   user    5m4.580s
   sys     0m0.320s

This is still six times as long as the 50 seconds of your C program, but
much better than the (unfinished) 18 minutes above.

So I believe that for practical uses, where processing does not consist
solely of arithmetics, the overhead will be negligible, and not justify
extra efforts.

If we'd want to optimize it, we should improve the decimal output
conversion.

Cheers,
- Alex
-- 
UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe

Reply via email to