[gambit-list] Lowest common denominator calculation in ops on exact rationals can be postponed?
Mikael
mikael.rcv at gmail.com
Thu Oct 9 15:17:35 EDT 2014
Dear Brad,
Benchmark seems to show that doing any the following operations below with
a and b as argument compared to doing the same with c and d as argument is
about the following X slower:
*: 179x (0.23345 vs 0.0013 ms per operation)
/: 2.7x (0.23269 vs 0.0889 ms per operation)
+: 202x (0.12112 vs 0.0006 ms per operation)
-: 200x (0.12008 vs 0.0006 ms per operation)
I guess this is because in the further case, the respective operation
involves the calculation of a lowest common denominator for the divisor
(i.e. what makes (+ 1/3 (+ 3/4 5/6)) and (+ (+ 1/3 3/4) 5/6) get the same
result)?
If so, I guess we can be clear that primarily for * + - , in batch
calculations there'd be value in having the ability to perform those
operations without that calculation, and then making a separate operation
for that function - or are the algorithms such that postponing wouldn't
actually be for the win?
At what location in Gambit's sources is this calculation performed?
Thanks,
Mikael
(define (r) (random-integer (expt 10 100)))
(define a (/ (r) (r)))
(define b (/ (r) (r)))
(define c (r))
(define d (r))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20141009/c41f36c7/attachment.htm>
More information about the Gambit-list
mailing list