From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ihor Radchenko Newsgroups: gmane.emacs.devel Subject: Re: Markers in a gap array Date: Thu, 04 Jul 2024 14:30:47 +0000 Message-ID: <87le2hp6ug.fsf@localhost> References: <87ikxlqwu6.fsf@localhost> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4596"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Jul 04 16:30:12 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sPNTP-0000xu-L7 for ged-emacs-devel@m.gmane-mx.org; Thu, 04 Jul 2024 16:30:11 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sPNSd-0002Qj-Ms; Thu, 04 Jul 2024 10:29:23 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sPNSb-0002QZ-Nm for emacs-devel@gnu.org; Thu, 04 Jul 2024 10:29:21 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sPNSZ-0000Ep-L7 for emacs-devel@gnu.org; Thu, 04 Jul 2024 10:29:21 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id D5B49240103 for ; Thu, 4 Jul 2024 16:29:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1720103356; bh=n9Yj5dGe/6hcGmgjzEOhQoyUkhKrBrZBXblwxjgwoRk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: From; b=RQNFIo0woSu+oHn4/348wgbWKOSpkrUYiK23PtZOZtnAgcTSjPq2KayHzuPE/f1v+ YBTuVEQIoTNyD/sh27vgpnVAXhDf2nG2bw+mOB/JXxVAi2n1xtwC19xTl6o30jYD9L L9UIdFr4Ris1MSzbcFkiOorGlR1xMWS88z8ziWd6S5Nd1FJbxrt08cNKunK/RfvWNd 9jx8EQCOmzn71tII+WJT1gr13C5EKcjMW27GmtGOB813DTkljbAcGNHYE8nTur/uBo etfDQFDdpr4cTf2A9cIrns8ul9q+oqH+cEUCQT6u7y9aci1Sk8nEIf9suitG91hnLG zuRFq2HK/A3KA== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4WFJth19Xpz9rxD; Thu, 4 Jul 2024 16:29:15 +0200 (CEST) In-Reply-To: Received-SPF: pass client-ip=185.67.36.66; envelope-from=yantar92@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:321320 Archived-At: Stefan Monnier 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 "\\(?:\\(?:\\\\)\\)\\)\\|\\(?:\\(?:<\\(?:[[: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 . Support Org development at , or support my work at