guix-patches
[Top][All Lists]
Advanced

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

[bug#50456] Optimise bytevector->nix-base32-string and bytevector->base1


From: Maxime Devos
Subject: [bug#50456] Optimise bytevector->nix-base32-string and bytevector->base16-string.
Date: Thu, 09 Sep 2021 17:15:54 +0200
User-agent: Evolution 3.34.2

Hi,

Here are the test results using (ice-9 time) with
the attached "time.scm" and guix/base16.scm,
to be run with ‘make && ./pre-inst-env guix repl time.scm’:

old:
clock utime stime cutime cstime gctime
 3.93  6.32  0.03   0.00   0.00   3.59
clock utime stime cutime cstime gctime
 3.92  6.32  0.03   0.00   0.00   3.59
clock utime stime cutime cstime gctime
 3.86  6.24  0.02   0.00   0.00   3.54
new:
clock utime stime cutime cstime gctime
 2.43  3.60  0.02   0.00   0.00   1.76
clock utime stime cutime cstime gctime
 2.49  3.67  0.01   0.00   0.00   1.77
clock utime stime cutime cstime gctime
 2.64  3.77  0.01   0.00   0.00   1.77

About half as much time is spent in GC.
The ‘utime’ is also half as much.  Not sure
what ‘clock’ means exactly, but it is reduced
as well.

Greetings,
Maxime
(define bv #vu8(95 120 195 50 116 227 63 169 222 86 89 38 92 145 126 37 192 55 
34))
(define (the-test p)
  (let loop ((n 0))
    (when (< n #e1e6)
      (p bv)
      (loop (+ n 1)))))

(display "old:\n")
;; Warm up the JIT
(the-test (@ (guix base16) bytevector->base16-string/old))
;; And time the procedure
((@ (ice-9 time) time) (the-test (@ (guix base16) 
bytevector->base16-string/old)))
((@ (ice-9 time) time) (the-test (@ (guix base16) 
bytevector->base16-string/old)))
((@ (ice-9 time) time) (the-test (@ (guix base16) 
bytevector->base16-string/old)))

(display "new:\n")
;; Warm up the JIT
(the-test (@ (guix base16) bytevector->base16-string))
;; And time the procedure
((@ (ice-9 time) time) (the-test (@ (guix base16) bytevector->base16-string)))
((@ (ice-9 time) time) (the-test (@ (guix base16) bytevector->base16-string)))
((@ (ice-9 time) time) (the-test (@ (guix base16) bytevector->base16-string)))

Attachment: base16.scm
Description: Text Data

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

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