beneroth has quit [Ping timeout: 260 seconds]
aw- has quit [Ping timeout: 276 seconds]
aw- has joined #picolisp
beneroth has joined #picolisp
beneroth has quit [Read error: Connection reset by peer]
beneroth has joined #picolisp
iacore has joined #picolisp
iacore_ has joined #picolisp
iacore_ has quit [Remote host closed the connection]
iacore has quit [Remote host closed the connection]
iacore has joined #picolisp
<
tankf33der>
hi all
<
tankf33der>
abu[7]: trying to find the fastest way to generate 1M digit.
<
abu[7]>
Hi tankf33der! A number?
<
abu[7]>
Probably via 'rd'
<
tankf33der>
(in "/dev/urandom" (rd <bignumber>)) ?
<
tankf33der>
slowest way on my side
<
abu[7]>
In any case first 'gc' enough heap
<
abu[7]>
might be the bottleneck
<
tankf33der>
reading from file 1M digit is the fastest way
<
abu[7]>
in decimal?
<
abu[7]>
I thought it is rather slow due to the decimal conversion
<
abu[7]>
Probably faster is reading a digit string "123..."
<
abu[7]>
(setq S "1111111111111111111111111111111111111")
<
abu[7]>
(struct (- (adr S) 8) T)
<
abu[7]>
-> 244644026569582887811651565519753749734...
<
abu[7]>
cause the name is a (big)num
pablo_escoberg has joined #picolisp
<
tankf33der>
format is bottleneck after some length
<
abu[7]>
Yes, decimal conversion is very expensive (*lots* of divisions)
bjorkintosh has quit [Ping timeout: 260 seconds]
chexum has quit [Remote host closed the connection]
chexum has joined #picolisp
<
abu[7]>
In fact, 'format' does not simply do a division and modulus for each decimal digit.
<
abu[7]>
This would be extremely expensiv for bignums
<
abu[7]>
Instead, it checks each bit and does a BCD addition if non-zero
<
abu[7]>
: (vi 'llvm~fmtNum)
<
abu[7]>
It is also used in number printing
<
tankf33der>
I am modifying the program to perform formatting less frequently.
bjorkintosh has joined #picolisp
bjorkintosh has joined #picolisp
beneroth has quit [Ping timeout: 244 seconds]
beneroth has joined #picolisp