Hi Tomas,

> I was curious to try picolisp bignums and must say that for somebody
> doing anything serious, it is probably rather inefficient.  As a

I'm aware of that. The bignum implementation was not intended to be
particularly fast, or - to put it corrrectly - cannot be expected to be
very fast because numbers are implemented as linked lists instead of
arrays.

I believe the advantage of a singular internal structure (the cell)
outweighs the speed disadvantage. Short numbers are sufficiently fast,
but when numbers grow to a length of hundreds of cells, the speed will
probably go down with the square of the length. For practical programs,
I never experienced any bottlenecks due to arithmetic processing.

Raw arithmetic speed is not of such importance in Lisp as in other
languages, where most primitive operations (like array index
calculations) depend on it.


> Would not it be better to use gmp library for bignums if they are
> going to be supported?

For an application that needs the speed, why not? It is just a lot more
trouble to support and use it.


> What is the reason picolisp has bignums in the first place?  Do

Being "unlimited". One of the main goals of PicoLisp was that the
programmer should never have to think about size limits (see
"doc/ref.html#intro").


> you/somebody else use it for anything?  Would not it be simpler and

I did need it for the RSA library "lib/rsa.l" when I used the Java
Applet API.

Anywah, on a 32bit system, 10 digits for short numbers are not enough
for useful work.

> good enough on 64 bit systems not having them at all?

Also on 64 bits I do not want to remember making sure not to cross the
18-digit border. With scaled fixed point arithmetics this can easily
happen.

In addition, the bignum structures are needed internally anyway, as the
names of symbols are technically also bignums.


In the 64 bit system, the CDR part of a number cell is used now, too,
being more space-efficient. That is, a number is either a short number
(60 bits + sign), or a cell with 64 bits in the CAR, and a number in the
CDR.


> What impact on interfacing foreign libraries the asm rewrite have?

It will still be possible to call external libraries. And also
necessary, as the Posix system interface is used just as before, for
I/O, memory and process management, networking etc. It is only the part
that was written in C until now that is replaced.

Cheers,
- Alex
-- 
UNSUBSCRIBE: mailto:[EMAIL PROTECTED]

Reply via email to