emacs-devel
[Top][All Lists]
Advanced

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

Re: [Emacs-diffs] trunk r117007: Optimize cl-struct-slot-value; fix test


From: Stefan Monnier
Subject: Re: [Emacs-diffs] trunk r117007: Optimize cl-struct-slot-value; fix test
Date: Tue, 22 Apr 2014 00:34:10 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

> -  (elt inst (cl-struct-slot-offset struct-type slot-name)))
> +  ;; We could use `elt', but since the byte compiler will resolve the
> +  ;; branch below at compile time, it's more efficient to use the
> +  ;; type-specific accessor.
> +  (if (eq (cl-struct-sequence-type struct-type) 'vector)
> +      (aref inst (cl-struct-slot-offset struct-type slot-name))
> +    (nth (cl-struct-slot-offset struct-type slot-name) inst)))

It won't always resolve the (eq (cl-struct-sequence-type struct-type)
'vector) test at compile-time, tho.


        Stefan



reply via email to

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