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

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

bug#14769: [PATCH] optimize `concat's literals


From: Mattias Engdegård
Subject: bug#14769: [PATCH] optimize `concat's literals
Date: Wed, 19 Jun 2019 14:54:16 +0200

19 juni 2019 kl. 03.43 skrev Noam Postavsky <npostavs@gmail.com>:
> 
> Mattias Engdegård <mattiase@acm.org> writes:
> 
>> +    (dolist (arg (cdr form))
> 
>> +                   (let ((val (eval arg)))
> 
>> +                          ;; Constant arg: concat with previous.
>> +                          (setq accum (concat accum val)))))
> 
> Hmm, I think the OP's patch is careful not to concat in a loop like
> this: it's O(n^2).  I guess for most human written code n is small
> enough that it doesn't matter, but I could imagine this slowing
> compilation of a very big rx macro.

Yes, I thought it wouldn't matter but you are right. Updated patch attached.

For that matter, ry performs this optimisation itself, but it's also nice to 
have it in the compiler, since concat is frequently used to split long string 
constants in elisp source.

Attachment: 0001-Merge-consecutive-constant-concat-args-bug-14769.patch
Description: Binary data


reply via email to

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