From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Pip Cet Newsgroups: gmane.emacs.devel Subject: Re: Markers in a gap array Date: Thu, 04 Jul 2024 20:34:00 +0000 Message-ID: References: <87ikxlqwu6.fsf@localhost> <87le2hp6ug.fsf@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30122"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Ihor Radchenko , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Jul 05 07:34:14 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 1sPbaH-0007cK-US for ged-emacs-devel@m.gmane-mx.org; Fri, 05 Jul 2024 07:34:13 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sPbZM-0003yT-Th; Fri, 05 Jul 2024 01:33:18 -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 1sPT9e-0004fj-Cv for emacs-devel@gnu.org; Thu, 04 Jul 2024 16:34:10 -0400 Original-Received: from mail-40131.protonmail.ch ([185.70.40.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sPT9c-0003RT-Fj for emacs-devel@gnu.org; Thu, 04 Jul 2024 16:34:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1720125246; x=1720384446; bh=IkYfGhp60x7WQA3s7h2j9WmhJVsnxjHR2cdl6gt5jFo=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=SDyzGF6sYM4Ej8G335YX4soxPG3cXgY0RShKOuu7sIwjCWt7+pyz9oDRWS0tTk9jA Pqmr3f8/QLmkq9Bk1eyvmkZE7UQdlqrRqmWyY+SUI6rf1btW6Bkc46UPOLdEHPfYHD Da/Sdl9+0+VheAf7d0gvAuYYrI3zxFQBeweclsXsyOXxJgRU0tC2qddcXYeNCNYuMW 57R3g1V0vD11QXRQTTOKHJyaPncOovYv9RLoAopMliyfkisZ7mQFACt69ScLIaDvi3 mpxEJYfJMs3Vk+3Y1C27ihDsAcLsPp0bgqHOmGaT252q8mzZKqOi8KODsm2IE2t+kM B10CfMs/ppZaQ== In-Reply-To: Feedback-ID: 112775352:user:proton X-Pm-Message-ID: 32f13f934b8d7ddaa424aadad8c3085ca8178951 Received-SPF: pass client-ip=185.70.40.131; envelope-from=pipcet@protonmail.com; helo=mail-40131.protonmail.ch X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, FREEMAIL_FROM=0.001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Fri, 05 Jul 2024 01:33:10 -0400 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:321369 Archived-At: On Thursday, July 4th, 2024 at 20:11, Stefan Monnier wrote: > Ihor Radchenko [2024-07-04 14:30:47] wrote: > > Stefan Monnier monnier@iro.umontreal.ca writes: > >=20 > > > > Some perf stats: > > > >=20 > > > > ;; Switch to todo and mark next 3 times, on branch > > > > ;; 28.72% emacs emacs > > > > [.] markers_sanity_check > > >=20 > > > Did you build with or without assertions? > >=20 > > Without. > >=20 > > > 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, sor= ry. > >=20 > > 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. >=20 >=20 > Hmm... I tried a benchmark based on: >=20 > (defconst elb-bytechar-buffer > (let ((buf (get-buffer-create " elb-bytechar"))) > (with-current-buffer buf > (let ((step (apply #'concat "=F0=9F=99=82 foo\n" (make-list 2000 "asdf ")= ))) > (dotimes (_ (/ 10000000 (length step))) > (insert step)) > buf)))) >=20 > (defconst elb-bytechar-re "\\<.\\> \\<.\\> bar") >=20 >=20 > (defun elb-bytechar--aux (nmarkers lookup &optional marker-fun) > (with-current-buffer elb-bytechar-buffer > (let ((step (/ (buffer-size) nmarkers)) > (markers nil)) > (dotimes (i nmarkers) > (push (copy-marker (funcall (or marker-fun #'identity) (* i step))) > markers)) > (dotimes (_ 10) > (goto-char (point-min)) > (let ((parse-sexp-lookup-properties lookup)) > (re-search-forward elb-bytechar-re nil t)))))) >=20 > where I call `elb-bytechar--aux` with various arguments. Could you share a more complete recipe for the benchmark? I wonder how it c= ompares to Gerd's weak vector/freelist in scratch/igc. I think this is very exciting, even though it might have been triggered by = incorrectly-reported numbers of markers :-) Pip