guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CPU and GC cost of bignums


From: Ludovic Courtès
Subject: Re: CPU and GC cost of bignums
Date: Sat, 08 Feb 2020 15:05:24 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

Hi,

Ludovic Courtès <address@hidden> skribis:

> To my surprise, on a pure bignum microbenchmark, this is
> counterproductive:

I found out that I was comparing my own Guile build, which was against
the ‘libgc-back-pointers’ package, with that ‘guile-next’ build against
‘libgc’; no wonder mine was slower…

--8<---------------cut here---------------start------------->8---
$ cat ~/src/guile-debugging/bignum-finalizers.scm
(use-modules (ice-9 time))

(time
 (let loop ((n (expt 2 18))
            (i 1))
   (unless (zero? n)
     ;; (display ".")
     (loop (- n 1)
           (logior 0 (ash i 1))))))

(format #t "heap size: ~a MiB~%"
        (round
         (/ (assoc-ref (gc-stats) 'heap-size) (expt 2. 20))))
--8<---------------cut here---------------end--------------->8---

There’s no noticeable difference on the microbenchmark when using the
same libgc both times, and there’s still ~2.5x difference when compiling
‘gnu/services/mail.scm’.

I went ahead and pushed the change as 00fbdfa7345765168e14438eed0b0b8c64c27ab9.

I did a full bootstrap build, which went fine and felt faster, though I
don’t have hard figures to compare to (110m user according to Bash’
‘time’ on my laptop).

Give it a spin and let me know!

Thanks,
Ludo’.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]