emacs-devel
[Top][All Lists]
Advanced

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

Re: pcase-memoize: equal first branch, yet different


From: Stefan Monnier
Subject: Re: pcase-memoize: equal first branch, yet different
Date: Tue, 05 Mar 2013 10:41:16 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

> Would it make sense to implement some parts of `pcase' at the C level?

No, that sounds like a nightmare.

> As it becomes widely used, byte-compilation delays can also become
> significant.

pcase's expansion is not *that* slow.  The problem is when it happens
during evaluation in a loop, where macro expansion takes significantly
more time (and memory) than the naive "try all patterns" would, so it
can slow down evaluation by a large factor (think of
macroexp--expand-all as a typical example: a large portion of the time
is spent matching patterns, which means that it's worthwhile for the
pcase macro to work hard to optimize the resulting code, but if the
macro is re-expanded each time, this effort backfires).

In reality, now that we have eager macroexpansion, the performance
problems should be very rare (i.e. only happen in those rare cases like
the one you posted, where the pcase is inside a chunk of code that's
created at run time) and we could probably get away without memoizing.


        Stefan



reply via email to

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