From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.bugs Subject: bug#58558: 29.0.50; re-search-forward is slow in some buffers Date: Mon, 10 Apr 2023 10:48:05 +0200 Message-ID: <691CBF62-4E1E-495C-8AAF-8B0EEE3E199A@gmail.com> References: <877d10r21x.fsf@localhost> Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_3EAC798E-B366-43D3-83FC-DFDBA015461F" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10636"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 58558@debbugs.gnu.org, Eli Zaretskii , Stefan Monnier To: Ihor Radchenko Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Apr 10 10:49:29 2023 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 1plnDN-0002ep-K6 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 10 Apr 2023 10:49:29 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1plnD4-0006yW-ES; Mon, 10 Apr 2023 04:49:10 -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 1plnCw-0006xd-Au for bug-gnu-emacs@gnu.org; Mon, 10 Apr 2023 04:49:03 -0400 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 1plnCw-0000Sw-1h for bug-gnu-emacs@gnu.org; Mon, 10 Apr 2023 04:49:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1plnCv-0002jB-UF for bug-gnu-emacs@gnu.org; Mon, 10 Apr 2023 04:49:01 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: <877d10r21x.fsf@localhost> Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 10 Apr 2023 08:49: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.168111649510340 (code B ref 58558); Mon, 10 Apr 2023 08:49:01 +0000 Original-Received: (at 58558) by debbugs.gnu.org; 10 Apr 2023 08:48:15 +0000 Original-Received: from localhost ([127.0.0.1]:34285 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1plnCB-0002gh-2O for submit@debbugs.gnu.org; Mon, 10 Apr 2023 04:48:15 -0400 Original-Received: from mail-lj1-f170.google.com ([209.85.208.170]:41512) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1plnC9-0002fn-KX for 58558@debbugs.gnu.org; Mon, 10 Apr 2023 04:48:13 -0400 Original-Received: by mail-lj1-f170.google.com with SMTP id n22so2810509ljq.8 for <58558@debbugs.gnu.org>; Mon, 10 Apr 2023 01:48:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1681116487; x=1683708487; h=to:cc:date:message-id:subject:mime-version:from:sender:from:to:cc :subject:date:message-id:reply-to; bh=vGbRZwX3OGDVN4jcfGBrrxUYwkTp5aN3H/0MeX5N3Ww=; b=N8QlBNGmynn4mQbKT3Ax0k1mljo+bac68kdntcujK2E+QR1QrSqwEsofGbZp6WGlzp A4vncpY1X/Q2DZ5zZ+oe/OqGXE1LOnvT1zdipooC8lAiZjBo1R4fK8IWie/VMzVcvukd v8gMLCzYwR1haYdjOtvSE023ws0TL+znIPwLco1DG/O5wb1Vl0Xg0RZeJS27YDywiWSf 6cszDEBYocHxai2V+GeiLpPjSAva2dT/c1nqWRH64SAG9Bt5lUWxM66DgisZ6yhia64x F8wKXT5ctbiSdlpAvJNBJ7+7lZmKFZ3PMOT2OwugOoNU4Sma0NeS1quEME0LU189zBIE ZUWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681116487; x=1683708487; h=to:cc:date:message-id:subject:mime-version:from:sender :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=vGbRZwX3OGDVN4jcfGBrrxUYwkTp5aN3H/0MeX5N3Ww=; b=BGzB1WKivJ11IJgPbZrC9l9uUyWVxUMWdiUnYTk5RYeevQa1KPm2+HWzZdnocx8rVf VblLvu3kNxghWuYpiC/2zb23Bzld3hJl/DrfgNNo5NJBtu09TuHUeEpinGbbkwsrPg/i SY8msp8HVz2tptBSHCvxsbnVpqdN3iQ4oNQoIPSe3dT4Ta4SBEXrPTFraUVpP2yg7f3U hgw2HiB6iwb7t75I5cj2S/8WTSKO5BWCdMjWLStFiARU7BeaKPCfRY32jVmB6sB60K+k GMYh14J+4i3ErYhVp4Be654RGvFbRWeheXAmJ65f+ULCb8mIJwzZg1wPg4dc0OAQ9oL0 kKpw== X-Gm-Message-State: AAQBX9e+YlNL7f6oNH1vh4ORPSBI2888vyaRhCV3M43CjB/a5Ryc2boQ wENEcqHP/lvEv7zQb3e2nW0= X-Google-Smtp-Source: AKy350a1AUBDXv9cyC5UmRXzoYriWyGOTB66BBkZ39n+DfY5d8/gq4p1555YGgvnogYDDYAn9Z5dpQ== X-Received: by 2002:a2e:7a10:0:b0:2a6:72:f321 with SMTP id v16-20020a2e7a10000000b002a60072f321mr3113266ljc.51.1681116486752; Mon, 10 Apr 2023 01:48:06 -0700 (PDT) Original-Received: from smtpclient.apple (c188-150-165-235.bredband.tele2.se. [188.150.165.235]) by smtp.gmail.com with ESMTPSA id z4-20020a2e8404000000b002a483f01d9csm2128502ljg.85.2023.04.10.01.48.06 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Apr 2023 01:48:06 -0700 (PDT) X-Mailer: Apple Mail (2.3654.120.0.1.15) 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:259551 Archived-At: --Apple-Mail=_3EAC798E-B366-43D3-83FC-DFDBA015461F Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Ihor, would you consider the possibility of regexp cache thrashing? It = does occur from time to time; that cache is quite small. Try this = instrumentation patch. (We should probably have something like it = permanently.) --Apple-Mail=_3EAC798E-B366-43D3-83FC-DFDBA015461F Content-Disposition: attachment; filename=0001-Add-regexp-cache-hit-miss-counters.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-Add-regexp-cache-hit-miss-counters.patch" Content-Transfer-Encoding: quoted-printable =46rom=20978ce66e9bd50da11997aeadcc3508549863a116=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20=3D?UTF-8?q?Mattias=3D20Engdeg=3DC3=3DA5rd?=3D=20= =0ADate:=20Sat,=207=20Nov=202020=2017:00:53=20+0100=0A= Subject:=20[PATCH=201/2]=20Add=20regexp=20cache=20hit/miss=20counters=0A=0A= ---=0A=20src/search.c=20|=2013=20++++++++++++-=0A=201=20file=20changed,=20= 12=20insertions(+),=201=20deletion(-)=0A=0Adiff=20--git=20a/src/search.c=20= b/src/search.c=0Aindex=204eb634a3c0..358b82da2e=20100644=0A---=20= a/src/search.c=0A+++=20b/src/search.c=0A@@=20-222,7=20+222,10=20@@=20= compile_pattern=20(Lisp_Object=20pattern,=20struct=20re_registers=20= *regp,=0A=20=09=20=20=20=20=20=20||=20EQ=20(cp->syntax_table,=20BVAR=20= (current_buffer,=20syntax_table)))=0A=20=09=20=20&&=20!NILP=20(Fequal=20= (cp->f_whitespace_regexp,=20Vsearch_spaces_regexp))=0A=20=09=20=20&&=20= cp->buf.charset_unibyte=20=3D=3D=20charset_unibyte)=0A-=09break;=0A+=20=20= =20=20=20=20=20=20{=0A+=20=20=20=20=20=20=20=20=20=20regexp_cache_hit++;=0A= +=20=20=20=20=20=20=20=20=20=20break;=0A+=20=20=20=20=20=20=20=20}=0A=20=0A= =20=20=20=20=20=20=20/*=20If=20we're=20at=20the=20end=20of=20the=20= cache,=20compile=20into=20the=20last=0A=20=09=20(least=20recently=20= used)=20non-busy=20cell=20in=20the=20cache.=20=20*/=0A@@=20-234,6=20= +237,7=20@@=20compile_pattern=20(Lisp_Object=20pattern,=20struct=20= re_registers=20*regp,=0A=20=20=20=20=20=20=20=20=20=20=20cp=20=3D=20= *cpp;=0A=20=09compile_it:=0A=20=20=20=20=20=20=20=20=20=20=20eassert=20= (!cp->busy);=0A+=20=20=20=20=20=20=20=20=20=20regexp_cache_miss++;=0A=20=09= =20=20compile_pattern_1=20(cp,=20pattern,=20translate,=20posix);=0A=20=09= =20=20break;=0A=20=09}=0A@@=20-3390,6=20+3394,13=20@@=20syms_of_search=20= (void)=0A=20is=20to=20bind=20it=20with=20`let'=20around=20a=20small=20= expression.=20=20*/);=0A=20=20=20Vinhibit_changing_match_data=20=3D=20= Qnil;=0A=20=0A+=20=20DEFVAR_INT("regexp-cache-hit",=20regexp_cache_hit,=0A= +=20=20=20=20=20=20=20=20=20=20=20=20=20doc:=20/*=20Regexp=20cache=20hit=20= count.=20=20Internal=20use=20only.=20*/);=0A+=20=20regexp_cache_hit=20=3D=20= 0;=0A+=20=20DEFVAR_INT("regexp-cache-miss",=20regexp_cache_miss,=0A+=20=20= =20=20=20=20=20=20=20=20=20=20=20doc:=20/*=20Regexp=20cache=20miss=20= count.=20=20Internal=20use=20only.=20*/);=0A+=20=20regexp_cache_miss=20=3D= =200;=0A+=0A=20=20=20defsubr=20(&Slooking_at);=0A=20=20=20defsubr=20= (&Sposix_looking_at);=0A=20=20=20defsubr=20(&Sstring_match);=0A--=20=0A= 2.21.1=20(Apple=20Git-122.3)=0A=0A= --Apple-Mail=_3EAC798E-B366-43D3-83FC-DFDBA015461F--