[Top][All Lists]

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

Re: [RFC] caar/cadr/cdar/cddr

From: Stefan Monnier
Subject: Re: [RFC] caar/cadr/cdar/cddr
Date: Thu, 12 Jul 2012 20:12:31 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux)

>> How widely?  I've always been leery about those functions, myself.

> $ grep -nHR "(car (car (" lisp | wc -l
> 45
> $ grep -nHR "(car (cdr (" lisp | wc -l
> 164
> $ grep -nHR "(cdr (car (" lisp | wc -l
> 45
> $ grep -nHR "(cdr (cdr (" lisp | wc -l
> 84

Static counts might not be related to dynamic counts and don't indicate
much either in terms of actual performance gains.

FWIW the current cXXr implementation using `defsubst' is not very
efficient because they're written in subr.el which does not use lexical
scoping, so the bytecodes that get inlined by the compiler include an
unneeded "varref x".  So you'd already get better performance by simply
moving these definitions to a file using lexical-binding.

> Not yet because byte-opt.el should be able to optimize
> (car (cdr X)) -> (cadr X) etc. Or, all Lisp sources
> should be converted manually :-).

It's easy to add such a rewrite to byte-optimize-lapcode.

>> We might want to save bytecodes for something more important.
> Do we really runs out of bytecode range?

Not really, but there aren't many left either.  Another issue is
breaking compatibility.  There are other bytecodes that will need to be
added to eliminate some glaring inefficiencies in lexical-binding code
(mostly Bunwind-protect, Bcondition-case, and Bcatch).


reply via email to

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