help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Adding many elements to a list


From: Pascal J. Bourguignon
Subject: Re: Adding many elements to a list
Date: Tue, 22 Sep 2009 14:37:15 +0200
User-agent: Gnus/5.101 (Gnus v5.10.10) Emacs/22.2 (gnu/linux)

David Kastrup <dak@gnu.org> writes:
> Well, consult its doc string for what it does and doesn't.  It's
> basically the same issue as with setf/setq: the cl version of push does
> a number of different things depending on a vague concept "location".
> But you almost never need this sort of flexibility at runtime, and at
> compile time, it obfuscates what actually happens, including the
> possible performance impacts.

You should write in assembler (what do I say, in binary!), because you
almost never need the flexibility that the bare push provide at
run-time, and at compilation time, it obfuscate what really happens,
including the possible performance impacts.

(disassemble (byte-compile (lambda (x) (push x *a*))))
-->
byte code:
  args: (x)
0       varref    x
1       varref    *a*
2       cons      
3       dup       
4       varset    *a*
5       return    

See?  There's a dup that's most often not used.  Performance IMPACT!

-- 
__Pascal Bourguignon__


reply via email to

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