Open milahu opened 2 years ago
Strange - (primes<2n 100)
ran almost instantly on my system (AMD FX-8320E, CPU max MHz 3200.0000)
Yeah, I finally ran this and it does run almost instantly for me too, both in debug and release mode (on an old Macbook).
Interestingly (primes<2n 100000)
fails when it reaches maximum recursion depth in append
, which is slow and not tail-recursive... I'll look into that
seems an issue with garbage collection
Strange -
(primes<2n 100)
ran almost instantly on my system
same, when i run only (primes<2n 100)
in a "fresh" peroxide interpreter (no history)
(primes<2n 1000)
takes about 3 seconds on my old 2x2.4GHz cpu, 2GB free ram
second run: also 3 seconds
third run: hangs forever
Ah, thanks for the explanation! I can reproduce that.
Definitely a GC problem: if I turn the GC off using --gc-mode off
, the run time doesn't increase on subsequent runs.
A few updates:
time
macro which returns the number of seconds it takes to execute its argumentappend
so it runs with constant memory use(primes<2n 100000)
now runs successfully, although it takes almost 8 minutes on my machine.
yay : )
;; all primes < 10^3 < 10^4 < 10^5 < 10^6
;; interpreter
;; petite (chez scheme) 8.4 0 sec 0 sec 2 sec 2 min
;; PLT-r5rs (racket) 5.3.6 0 sec 0 sec 2 sec 4 min
;; pi (rhizome/pi) 0.57 0 sec 0 sec 2 sec 6 min
;; gsi (gambit) 4.7.0 0 sec 0 sec 4 sec 13 min
;; csi (chicken) 4.8.0.5 0 sec 0 sec 10 sec 18 min
;; scheme 48 1.9 0 sec 0 sec 10 sec n/a
;; peroxide 480 sec
about 150K times slower than petite-chez
so now peroxide is only 240 times slower than petite-chez ; )
as expected for such a young project, peroxide is really slow, about 150K times slower than petite-chez
benchmark script from reddit