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.bugs Subject: bug#58558: 29.0.50; re-search-forward is slow in some buffers Date: Tue, 13 Dec 2022 15:56:33 +0000 Message-ID: <87fsdjwb4e.fsf@localhost> References: <877d10r21x.fsf@localhost> <87zgdwyvkt.fsf@gnus.org> <87ilkk6ri5.fsf@localhost> <87v8okjei9.fsf@gnus.org> <87tu44jdce.fsf@localhost> <87czasjd9j.fsf@gnus.org> <87k050nio5.fsf@localhost> <87zgdwhw0z.fsf@gnus.org> <83sfjo3tfw.fsf@gnu.org> <878rlfjmjh.fsf@localhost> <87mt9tbbbp.fsf@gnus.org> <8335bl18lo.fsf@gnu.org> <87wn8x9eqb.fsf@gnus.org> <87tu1zd2c6.fsf@localhost> <83h6xzphxm.fsf@gnu.org> <87wn6vbfaa.fsf@localhost> <838rjbpecw.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26001"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 58558@debbugs.gnu.org, larsi@gnus.org, monnier@iro.umontreal.ca To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Dec 13 16:57:26 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1p57em-0006YA-Se for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 13 Dec 2022 16:57:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p57eT-0000Lt-Jm; Tue, 13 Dec 2022 10:57:05 -0500 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 1p57eQ-0000JS-Mu for bug-gnu-emacs@gnu.org; Tue, 13 Dec 2022 10:57:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p57eQ-0001cY-F7 for bug-gnu-emacs@gnu.org; Tue, 13 Dec 2022 10:57:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p57eQ-0005bJ-0h for bug-gnu-emacs@gnu.org; Tue, 13 Dec 2022 10:57:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Ihor Radchenko Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 13 Dec 2022 15:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58558 X-GNU-PR-Package: emacs Original-Received: via spool by 58558-submit@debbugs.gnu.org id=B58558.167094700921520 (code B ref 58558); Tue, 13 Dec 2022 15:57:01 +0000 Original-Received: (at 58558) by debbugs.gnu.org; 13 Dec 2022 15:56:49 +0000 Original-Received: from localhost ([127.0.0.1]:32973 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p57eD-0005b2-AT for submit@debbugs.gnu.org; Tue, 13 Dec 2022 10:56:49 -0500 Original-Received: from mout01.posteo.de ([185.67.36.65]:60995) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p57eB-0005au-Dd for 58558@debbugs.gnu.org; Tue, 13 Dec 2022 10:56:48 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 78CF324002D for <58558@debbugs.gnu.org>; Tue, 13 Dec 2022 16:56:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1670947001; bh=NL7qAAIR2xFz0H7RcjOtFBE6YQ4dM6GLuO3slMd9f/4=; h=From:To:Cc:Subject:Date:From; b=LzmnlhT3kP+ht5tOsUIBznTp9ckrPqI6KLZwGdxLvmtE1oSy7JZb3Ru9ZjI/XBPH3 S7H8yyyY6NiY5hEgBK6YGz+jQvctJAm6wkqb8ulf3TaCgj8yhlIn0acvLFBD9kmKeC Vhk+onbU/pauDm0e5tkSaYfF5vPCM4PBbuDv4jeDwRrrrGv2XhyNPn60IrCyO1/3XA hi+soUyhXpdLEIfjejbu1VwaVWdodfctu6Ab4DjVmCXfacJjMP52k6c/yoOFqnNlOQ RU/9jr3LCQdVTHYzZf6HRAo5E8V8nkTcaSW+zXdM7vUFMED2opt9pUgjf6DPK3FHPP SG8y3XXvHRmuw== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4NWjm74g38z6tm9; Tue, 13 Dec 2022 16:56:39 +0100 (CET) In-Reply-To: <838rjbpecw.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:250853 Archived-At: Eli Zaretskii writes: >> I will look how to do it. Maybe perf probe. >> I guess, it will be useful to compile Emacs with debug symbols at this >> point. > > AFAIR, you can ask perf to profile a single function, and you can ask > it to annotate the profile with the source code. I now compiled Emacs with debug symbols, waited enough to see observable increase in the benchmark-run timing, and recorded the perf data. buf_bytepos_to_charpos is still on the top 78.06% emacs emacs [.] buf_bytepos_to_charpos 3.00% emacs emacs [.] re_match_2_internal 1.05% emacs emacs [.] find_interval 1.04% emacs emacs [.] CHAR_TABLE_REF_ASCII 0.85% emacs emacs [.] make_lisp_symbol 0.80% emacs emacs [.] re_search_2 0.76% emacs emacs [.] builtin_lisp_symbol 0.62% emacs emacs [.] PSEUDOVECTORP The specific place in the code is: perf annotate -s buf_bytepos_to_charpos : 352 for (tail = BUF_MARKERS (b); tail; tail = tail->next) 0.00 : 237e53: mov -0xe8(%rbp),%rax 0.00 : 237e5a: mov 0x2e8(%rax),%rax 0.01 : 237e61: mov 0x80(%rax),%rax 0.00 : 237e68: mov %rax,-0xc0(%rbp) 0.00 : 237e6f: jmp 237fc6 : 353 { : 354 CONSIDER (tail->bytepos, tail->charpos); 0.02 : 237e74: mov -0xc0(%rbp),%rax 47.07 : 237e7b: mov 0x28(%rax),%rax 7.27 : 237e7f: mov %rax,-0x38(%rbp) 0.02 : 237e83: movl $0x0,-0xc4(%rbp) 9.05 : 237e8d: mov -0x38(%rbp),%rax 0.01 : 237e91: cmp -0xf0(%rbp),%rax 3.73 : 237e98: jne 237eb2 0.00 : 237e9a: mov -0xc0(%rbp),%rax 0.00 : 237ea1: mov 0x20(%rax),%rax 0.00 : 237ea5: mov %rax,-0x28(%rbp) 0.00 : 237ea9: mov -0x28(%rbp),%rax 0.00 : 237ead: jmp 2381cd 2.14 : 237eb2: mov -0x38(%rbp),%rax 1.87 : 237eb6: cmp -0xf0(%rbp),%rax 0.85 : 237ebd: jle 237ef5 2.32 : 237ebf: mov -0x38(%rbp),%rax 0.04 : 237ec3: cmp -0xb0(%rbp),%rax 2.56 : 237eca: jge 237f29 My guess: number of markers is growing somehow? -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at