From: Ihor Radchenko <yantar92@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: master 979308b4ca 5/9: org-export-data: Concatenate strings in temporary buffer for performance
Date: Thu, 16 Jun 2022 20:49:27 +0800 [thread overview]
Message-ID: <87y1xwept4.fsf@localhost> (raw)
In-Reply-To: <jwva6aczts1.fsf-monnier+emacs@gnu.org>
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> Eli Zaretskii [2022-06-16 04:09:44] wrote:
>> org-export-data: Concatenate strings in temporary buffer for performance
>>
>> * lisp/org/ox.el (org-export-data): Use temporary buffer to collect export
>> data instead of `mapconcat'. Using buffer puts less load on garbage
>> collector.
>
> AFAICT this just replaces `mapconcat` with a `with-temp-buffer + dolist
> + insert`, so if this makes a significant performance difference, it
> points to a performance problem in our `mapconcat`, right?
I hope that I did not get it wrong. I _believe_ that I did see an
improvement. So, you better check if it makes a difference on your side
if you revert that patch (especially with un-optimized build where the
differences should be more prominent).
AFAIK, there are several caveats with `mapconcat':
1. The way it was used in Org before the patch was
(mapconcat #function sequence "")
Here, `mapconcat' will call `concat' to generate the new string with 2N
number of arguments. Half of the arguments will be "".
2. `concat' is doing ad-hoc save/restore of text properties. IDK if it
matters in this particular case, but buffers should work more
efficiently with handling text properties (AFAIK)
3. `concat' tries to consider non-string argument adding some (probably
small) extra overheads.
Best,
Ihor
next prev parent reply other threads:[~2022-06-16 12:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <165536698076.5328.17316430648307086249@vcs2.savannah.gnu.org>
[not found] ` <20220616080945.7DD14C01685@vcs2.savannah.gnu.org>
2022-06-16 12:19 ` master 979308b4ca 5/9: org-export-data: Concatenate strings in temporary buffer for performance Stefan Monnier
2022-06-16 12:45 ` Lars Ingebrigtsen
2022-06-16 13:33 ` Robert Pluim
2022-06-16 12:49 ` Ihor Radchenko [this message]
2022-06-16 17:43 ` Stefan Monnier
2022-06-17 11:35 ` Ihor Radchenko
2022-06-16 12:53 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y1xwept4.fsf@localhost \
--to=yantar92@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.