GNU bug report logs - #14769
24.3.50; [PATCH] optimize `concat's literals

Previous Next

Package: emacs;

Reported by: Shigeru Fukaya <shigeru.fukaya <at> gmail.com>

Date: Tue, 2 Jul 2013 17:05:02 UTC

Severity: wishlist

Tags: patch

Found in version 24.3.50

Done: Mattias Engdegård <mattiase <at> acm.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Mattias Engdegård <mattiase <at> acm.org>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, Stefan Monnier <monnier <at> iro.umontreal.ca>, 14769 <at> debbugs.gnu.org, shigeru.fukaya <at> gmail.com
Subject: bug#14769: [PATCH] optimize `concat's literals
Date: Wed, 19 Jun 2019 14:54:16 +0200
[Message part 1 (text/plain, inline)]
19 juni 2019 kl. 03.43 skrev Noam Postavsky <npostavs <at> gmail.com>:
> 
> Mattias Engdegård <mattiase <at> 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.
[0001-Merge-consecutive-constant-concat-args-bug-14769.patch (application/octet-stream, attachment)]

This bug report was last modified 5 years and 335 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.