all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: Markers in a gap array
Date: Thu, 04 Jul 2024 14:30:47 +0000	[thread overview]
Message-ID: <87le2hp6ug.fsf@localhost> (raw)
In-Reply-To: <jwvwmm1e1yi.fsf-monnier+emacs@gnu.org>

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> Some perf stats:
>>
>> ;; Switch to todo and mark next 3 times, on branch
>>     ;; 28.72%  emacs            emacs                                      [.] markers_sanity_check
>
> Did you build with or without assertions?

Without.

> And indeed, I need to rework them to be "more conditional" (but I was
> focused on correctness until now).  You should probably remove those
> calls to `markers_sanity_check` by hand when testing performance, sorry.

Without these calls, I can see some speed improvement in
buf_bytepos_to_charpos, but I do not currently have a reliable
reproducer to trigger buf_bytepos_to_charpos slowdown on master, so it
is comparing very small numbers.

I do not see any noticeable overall performance degradation either
though.

My test:

(setq yant/re "\\(?:\\(?:\\<DEADLINE: *\\(\\(?:<\\(?:[[:digit:]]\\{4\\}-[[:digit:]]\\{2\\}-[[:digit:]]\\{2\\}\\(?: [[:alpha:]]+\\)?\\)\\(?: [[:digit:]]\\{1,2\\}:[[:digit:]]\\{2\\}\\(?:-[[:digit:]]\\{1,2\\}:[[:digit:]]\\{2\\}\\)?\\)?\\(?:\\(?: [+.:-]\\{1,2\\}[[:digit:]]+[dhmwy]\\(?:/[[:digit:]]+[dhmwy]\\)?\\)\\{1,2\\}\\)?>\\)\\)\\)\\|\\(?:\\(?:<\\(?:[[:digit:]]\\{4\\}-[[:digit:]]\\{2\\}-[[:digit:]]\\{2\\}\\(?: [[:alpha:]]+\\)?\\)\\(?: [[:digit:]]\\{1,2\\}:[[:digit:]]\\{2\\}\\(?:-[[:digit:]]\\{1,2\\}:[[:digit:]]\\{2\\}\\)?\\)?\\(?:\\(?: [+.:-]\\{1,2\\}[[:digit:]]+[dhmwy]\\(?:/[[:digit:]]+[dhmwy]\\)?\\)\\{1,2\\}\\)?>\\)\\|^\\*+[[:blank:]]+\\(?:[[:upper:]]+[[:blank:]]+\\)?\\[#A]\\|^[[:space:]]*:STYLE:[[:space:]]+habit[[:space:]]*$\\)\\)")
(benchmark-progn (goto-char (point-min)) (while (re-search-forward yant/re nil t)))
(benchmark-run 10 (goto-char (point-min)) (while (re-search-forward yant/re nil t)))

;; On the branch

;; # Samples: 35K of event 'cycles:Pu'
;; # Event count (approx.): 37616970588
;; #
;; # Overhead  Command       Shared Object                Symbol                                      
;; # ........  ............  ...........................  ............................................
;; #
;;     54.99%  emacs         emacs                        [.] re_match_2_internal
;;     18.19%  emacs         emacs                        [.] re_search_2
;;      8.13%  emacs         emacs                        [.] sub_char_table_ref
;;      4.49%  emacs         emacs                        [.] char_table_ref
;;      3.66%  emacs         emacs                        [.] unbind_to
;;      2.05%  emacs         emacs                        [.] unwind_re_match
;;      1.78%  emacs         emacs                        [.] extract_number_and_incr
;;      1.70%  emacs         emacs                        [.] string_char_and_length
;;      1.01%  emacs         emacs                        [.] extract_address
;;      0.96%  emacs         emacs                        [.] buf_bytepos_to_charpos
;;      0.83%  emacs         emacs                        [.] record_unwind_protect_ptr
;;      0.68%  emacs         emacs                        [.] execute_charset

;; On master

;; # Samples: 44K of event 'cycles:Pu'
;; # Event count (approx.): 40534509250
;; #
;; # Overhead  Command       Shared Object                                  Symbol                                                                                                        
;; # ........  ............  .............................................  ..............................................................................................................
;; #
;;     52.60%  emacs         emacs                                          [.] re_match_2_internal
;;     16.88%  emacs         emacs                                          [.] re_search_2
;;      7.80%  emacs         emacs                                          [.] sub_char_table_ref
;;      3.65%  emacs         emacs                                          [.] char_table_ref
;;      3.42%  emacs         emacs                                          [.] unbind_to
;;      2.21%  emacs         emacs                                          [.] buf_bytepos_to_charpos
;;      1.90%  emacs         emacs                                          [.] unwind_re_match
;;      1.87%  emacs         emacs                                          [.] extract_number_and_incr
;;      1.62%  emacs         emacs                                          [.] string_char_and_length
;;      0.97%  emacs         emacs                                          [.] extract_address
;;      0.92%  emacs         emacs                                          [.] scan_sexps_forward
;;      0.82%  emacs         emacs                                          [.] record_unwind_protect_ptr
;;      0.70%  emacs         emacs                                          [.] execute_charset

-- 
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>



  reply	other threads:[~2024-07-04 14:30 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-04  4:59 Markers in a gap array Stefan Monnier
2024-07-04 10:24 ` Ihor Radchenko
2024-07-04 13:16   ` Stefan Monnier
2024-07-04 14:30     ` Ihor Radchenko [this message]
2024-07-04 20:11       ` Stefan Monnier
2024-07-04 20:34         ` Pip Cet
2024-07-04 20:42           ` Stefan Monnier
2024-07-17 16:48             ` Helmut Eller
2024-07-18 20:46               ` Stefan Monnier
2024-07-26 19:48                 ` Helmut Eller
2024-08-05 19:54                   ` MPS: marker-vector (was: Markers in a gap array) Helmut Eller
2024-08-05 21:14                     ` MPS: marker-vector Pip Cet
2024-08-06  6:28                       ` Helmut Eller
2024-08-06  6:51                         ` Gerd Möllmann
2024-08-06 14:36                         ` Pip Cet
2024-08-06 16:15                           ` Helmut Eller
2024-08-06  3:59                     ` Gerd Möllmann
2024-08-06  6:02                       ` Helmut Eller
2024-07-04 22:24         ` Markers in a gap array Stefan Monnier
2024-07-07 12:31         ` Ihor Radchenko
2024-07-07 13:09         ` Konstantin Kharlamov

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=87le2hp6ug.fsf@localhost \
    --to=yantar92@posteo.net \
    --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.