emacs-devel
[Top][All Lists]
Advanced

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

Re: Markers in a gap array


From: Ihor Radchenko
Subject: Re: Markers in a gap array
Date: Thu, 04 Jul 2024 14:30:47 +0000

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 via email to

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