Hello,

In the ‘wip-vlist’ branch (which is about implementing Bagwell’s vlists)
SRFI-9 is reimplemented in terms of raw structs, instead of records.

The advantage is that it makes it easy to write a macro-generating macro
akin to Dybvig’s ‘define-integrable’ [0] and use it to define record
accessors such that direct calls to accessors are effectively inlined.

On the attached use case, inlining reduces execution time by ~15%.  It
also has a noticeable impact on the vlist implementation itself.

If there are no objections I’ll commit it to ‘master’.

Thanks,
Ludo’.

[0] http://www.scheme.com/tspl3/syntax.html#./syntax:s57
    Thanks to Andy for pointing it out!

(use-modules (srfi srfi-9)
             (ice-9 time))

(define-record-type <foo>
  (make-foo x)
  foo?
  (x get-x))

(define s (make-foo 1))

(define n 7000000)

(time (let loop ((i n))
        (and (> i 0)
             (begin
               (get-x s)
               (loop (1- i))))))

(time (let ((get-x get-x)) ;; prevent inlining
        (let loop ((i n))
          (and (> i 0)
               (begin
                 (get-x s)
                 (loop (1- i)))))))

Reply via email to