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

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

bug#51523: 29.0.50; gnus-mime-view-part-externally very slow


From: Stefan Monnier
Subject: bug#51523: 29.0.50; gnus-mime-view-part-externally very slow
Date: Wed, 03 Nov 2021 14:56:47 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

>>> -    (sym (concat (symbol-name tag) "@" file))
>>> +    (sym (concat (symbol-name tag) "@"
>>> +                      (if (file-name-absolute-p file)
>>> +                          file
>>> +                        (expand-file-name file))))
>> (cons tag (if (file-name-absolute-p file) file (expand-file-name file)))
>> is more efficient.
> I don't see a performance impact in my tests, but I'll trust the master.

It's likely lost in the noise, indeed, but `cons` just allocates
a single 2-word object, whereas your concat will allocate a Lisp_String
object (4-word object) plus the actual byte array (of N+M+1 bytes).
[ And if you're unlucky and one of the strings has text-properties
  applied to it, then you get a fair bit more since the interval tree
  then needs to be copied (and merged if both strings have
  properties).  ]

It also gives you cleaner behavior, since it avoids the possibility of
freak collisions when tag or file contains `@`.  IOW, it should be the
natural choice.


        Stefan






reply via email to

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