From: Ihor Radchenko <yantar92@posteo.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 65491@debbugs.gnu.org, Stefan Monnier <monnier@iro.umontreal.ca>
Subject: bug#65491: [PATCH] Improve performance allocating vectors
Date: Sat, 26 Aug 2023 07:47:34 +0000 [thread overview]
Message-ID: <87r0nq9re1.fsf@localhost> (raw)
In-Reply-To: <87ttsm9sbk.fsf@localhost>
Ihor Radchenko <yantar92@posteo.net> writes:
> If you know any useful code that makes heavy use of vector allocation, I
> can also benchmark it.
One example is the newer versions of Org parser, where I know for sure
that vector allocation is used. Although the code is mostly doing regexp
search for parsing, so a better real world example would be still useful.
I ran a quick parser run on a large Org file using
(let ((large-file-warning-threshold nil)
(gc-cons-threshold most-positive-fixnum)
(org-inhibit-startup t)
(org-element-cache-persistent nil))
(with-current-buffer (find-file-noselect "~/Org/notes.org")
(message "%s" (benchmark-call (lambda () (org-element-parse-buffer nil nil 'defer))))))
Without the patch:
$ perf record ./src/emacs -Q -batch -L ~/Git/org-mode/lisp -L ~/.emacs.d/eln-cache/30.0.50-17ebec90/ -l org-element -l /tmp/test.el
(15.724130802000001 1 0.429624333)
without the patch:
26.60% emacs emacs [.] exec_byte_code
12.40% emacs emacs [.] re_match_2_internal
8.70% emacs emacs [.] re_search_2
8.19% emacs emacs [.] re_compile_pattern
3.73% emacs emacs [.] re_iswctype
3.60% emacs emacs [.] funcall_subr
3.08% emacs emacs [.] allocate_vectorlike
2.70% emacs emacs [.] plist_get
1.80% emacs emacs [.] buf_charpos_to_bytepos
Vector allocation takes about 3% of the time.
-----------
with the patch, vector allocation contributions drops to 0.42% - 6x
decrease.
-----------
$ perf record ./src/emacs -Q -batch -L ~/Git/org-mode/lisp -L ~/.emacs.d/eln-cache/30.0.50-17ebec90/ -l org-element -l /tmp/test.el
(15.100695088 1 0.43508134400000004)
27.06% emacs emacs [.] exec_byte_code
12.96% emacs emacs [.] re_match_2_internal
8.90% emacs emacs [.] re_search_2
8.55% emacs emacs [.] re_compile_pattern
3.68% emacs emacs [.] re_iswctype
3.57% emacs emacs [.] funcall_subr
2.80% emacs emacs [.] plist_get
...
0.42% emacs emacs [.] allocate_vectorlike
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
next prev parent reply other threads:[~2023-08-26 7:47 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-24 9:59 bug#65491: [PATCH] Improve performance allocating vectors Ihor Radchenko
2023-08-26 7:14 ` Eli Zaretskii
2023-08-26 7:27 ` Ihor Radchenko
2023-08-26 7:31 ` Eli Zaretskii
2023-08-26 7:51 ` Ihor Radchenko
2023-08-26 8:07 ` Ihor Radchenko
2023-08-26 9:01 ` Eli Zaretskii
2023-08-26 7:47 ` Ihor Radchenko [this message]
2023-08-26 12:01 ` Mattias Engdegård
2023-08-26 14:54 ` Ihor Radchenko
2023-08-26 14:55 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-27 9:54 ` Mattias Engdegård
2023-09-16 14:58 ` Mattias Engdegård
2023-09-16 16:12 ` Eli Zaretskii
2023-09-16 16:17 ` Eli Zaretskii
2023-09-16 16:32 ` Mattias Engdegård
2023-09-16 16:54 ` Eli Zaretskii
2023-09-16 17:03 ` Mattias Engdegård
2023-09-16 17:11 ` Eli Zaretskii
2023-09-17 3:02 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-17 17:02 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-18 2:19 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-18 2:27 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-18 3:08 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-18 4:10 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-16 16:54 ` Mattias Engdegård
2023-09-16 17:09 ` Eli Zaretskii
2023-09-16 17:22 ` Mattias Engdegård
2023-09-16 18:19 ` Eli Zaretskii
2023-09-16 19:04 ` Mattias Engdegård
2023-09-16 19:46 ` Paul Eggert
2023-09-17 5:18 ` Eli Zaretskii
2023-09-17 15:22 ` Paul Eggert
2023-09-17 16:15 ` Eli Zaretskii
2023-09-17 16:37 ` Paul Eggert
2023-09-17 16:44 ` Eli Zaretskii
2023-09-18 16:10 ` Mattias Engdegård
2023-09-18 17:13 ` Eli Zaretskii
2023-09-19 13:28 ` Mattias Engdegård
2023-09-19 14:04 ` Eli Zaretskii
2023-09-19 14:05 ` Mattias Engdegård
2023-09-25 16:06 ` Mattias Engdegård
2023-08-27 16:21 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-28 10:14 ` Ihor Radchenko
2023-08-28 16:32 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-28 12:47 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r0nq9re1.fsf@localhost \
--to=yantar92@posteo.net \
--cc=65491@debbugs.gnu.org \
--cc=eliz@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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).