From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?K=C3=A9vin?= Le Gouguec Newsgroups: gmane.emacs.bugs Subject: bug#69555: 30.0.50; shr - Preserve indentation when shr-fill-text is nil Date: Wed, 06 Mar 2024 00:16:53 +0100 Message-ID: <87jzmgi80q.fsf@gmail.com> References: <87o7btzmdo.fsf@gmail.com> <87jzmhzm3v.fsf@gmail.com> <861q8onan6.fsf@gnu.org> <877cigzdo3.fsf@gmail.com> <86edcolav6.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15958"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 69555@debbugs.gnu.org, rahguzar@zohomail.eu To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Mar 06 00:18:57 2024 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 1rhe3j-0003v1-NQ for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 06 Mar 2024 00:18:55 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rhe3N-0004Tx-Ll; Tue, 05 Mar 2024 18:18:33 -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 1rhe3M-0004TU-0G for bug-gnu-emacs@gnu.org; Tue, 05 Mar 2024 18:18:32 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rhe3L-0006OK-Nh for bug-gnu-emacs@gnu.org; Tue, 05 Mar 2024 18:18:31 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rhe3q-0003vS-4Z for bug-gnu-emacs@gnu.org; Tue, 05 Mar 2024 18:19:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?K=C3=A9vin?= Le Gouguec Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 05 Mar 2024 23:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69555 X-GNU-PR-Package: emacs Original-Received: via spool by 69555-submit@debbugs.gnu.org id=B69555.170968071515056 (code B ref 69555); Tue, 05 Mar 2024 23:19:02 +0000 Original-Received: (at 69555) by debbugs.gnu.org; 5 Mar 2024 23:18:35 +0000 Original-Received: from localhost ([127.0.0.1]:49267 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rhe3O-0003ul-Sb for submit@debbugs.gnu.org; Tue, 05 Mar 2024 18:18:35 -0500 Original-Received: from mail-wr1-f51.google.com ([209.85.221.51]:52670) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rhe3M-0003uT-29 for 69555@debbugs.gnu.org; Tue, 05 Mar 2024 18:18:33 -0500 Original-Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-33d18931a94so3672584f8f.1 for <69555@debbugs.gnu.org>; Tue, 05 Mar 2024 15:18:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709680616; x=1710285416; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=gb/g77rL7L3tLm2S9T/lx/o5QjCbkW+wFxvo7z/DVs0=; b=TYA+CpkWYr1Cr5dMP4EIRhUNVqWNY927WGAyjHGAf8qEezQ9kKFjFkjOx/bn8oeLTo L61ZjrgoCnjhSHwp2RACkvT/TKQI3ZgNeriziRYKfAfa2TgHzSybLvJG2urPMoMQRSJK yQsEO/XaTX+iuUSgs4z0Gs0eyAajDoPtRGVDFcLsR6xn7gL+KAVB6dtmoA4q7Wvp5Ly5 7eCSWaMCoSQ2ksJJwcAXeEvVFWcBSp4lr/8EZU7uCmbk8lWnbOXY0shyZS+UpU/w1+PT cLguEvF40mT3auSRC30VGerWkWXScu5vap4TtbSpK2uio3TcqH3kRzMlPowvprAsRXEW frmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709680616; x=1710285416; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=gb/g77rL7L3tLm2S9T/lx/o5QjCbkW+wFxvo7z/DVs0=; b=QhNMtZm1xS0GxownBkZNn9ibpU+I4uIOtqMG4EoRHkmWrYfbW2K/4nsunPnC2WC5Wf jl5JIcQ/Z8CDmIs81HD7dhByIJt16jsJ1zyAg7vvYiuiKY2JaGe4D8YaJDnIISsTj5Jx IiQNs9gWM8oL2x0ePBvkRq/GSNVdzBQNxrZgP0/cJ/VLdJFFZjzNCNzOGMpZYMV61F4A Szk2uicp6k+C8R72PRJYACABHAEtjJLiNcgbp1oVoX3xSYHfGDlD6SjfQlPDuGVsb7Te PaBxoe04rS6zebQkAmp9RNwRgVT0YM1Mw6umLlcS6q739ipC3/s28A1V2QuZQ4jTB4Op 2lFw== X-Gm-Message-State: AOJu0YzkkUZh6RM+NKvqRFF0Q25liukeYAWcgCJJ3+7xAVtSKO1Xf7js jeJY0jlzYVuQn6oYbMoEfC/39tD8BYTT3QbCARzKCLLE568pH4sEovdlQZzsCLc= X-Google-Smtp-Source: AGHT+IEDYXVVvKgDj1P2DrlEPmoP8pWfj1vELECT8drKH+gDM2mvzvFO+JVmg9iS15vzsME0PQp5bQ== X-Received: by 2002:a5d:668f:0:b0:33d:c2cb:c18d with SMTP id l15-20020a5d668f000000b0033dc2cbc18dmr10583422wru.32.1709680615470; Tue, 05 Mar 2024 15:16:55 -0800 (PST) Original-Received: from amdahl30 ([2a01:e0a:253:fe0:2ef0:5dff:fed2:7b49]) by smtp.gmail.com with ESMTPSA id v13-20020adfd04d000000b0033d202abf01sm15922799wrh.28.2024.03.05.15.16.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 15:16:54 -0800 (PST) In-Reply-To: <86edcolav6.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 05 Mar 2024 21:47:09 +0200") 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:281087 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Eli Zaretskii writes: >> From: K=C3=A9vin Le Gouguec >> Cc: 69555@debbugs.gnu.org, rahguzar@zohomail.eu >> Date: Tue, 05 Mar 2024 20:22:52 +0100 >>=20 >> Eli Zaretskii writes: >>=20 >> > Also, please time the code on some substantially large body of text, >> > with and without shr-fill-text, and compare that with the current >> > version. I think performance is an important aspect of any change in >> > this area. >>=20 >> Can do; would "(elisp) Profiling" be the starting point? > > I think benchmark-run is a better starting point. > >> (Also wondering if we have any "standard" or preferred HTML documents or >> websites to throw at shr.el for benchmarking purposes; if not, I guess >> I'll peruse =F0=9F=A4= =94) > > Actually, something with a lot of text in large paragraphs, sometimes > indented, would be better. Those Wikipedia pages are basically long > lists, but there's not much opportunity there to perform filling and > indentation of large amounts of text, which is what is sought here. > Here's one possible candidate: > > https://debbugs.gnu.org/Developer.html Thanks for the pointers. Attaching the over-engineered scripts I built from that, which with 1000 REPETITIONS yield: 2024-03-05; 33976ecf244; 30.0.50; master shr-fill-text=3Dnil ( 3.= 013 23 0.313) 2024-03-04; b06916cb218; 30.0.50; shr-blockquote shr-fill-text=3Dnil ( 3.= 121 24 0.328) 2024-03-05; 33976ecf244; 30.0.50; master shr-fill-text=3Dt (32.= 331 65 0.904) 2024-03-04; b06916cb218; 30.0.50; shr-blockquote shr-fill-text=3Dt (32.= 045 65 0.902) I can bump up REPETITIONS if that would help; sending the scripts & results as-is before hitting the hay since I figure they might have some glaring methodology issues, or there is more information I might not have thought of reporting. If not, the tentative conclusion would be "shr-fill-text nil gets 4% slower; shr-fill-text t is none the worse for wear; nil still runs circles around t"? --=-=-= Content-Type: text/x-emacs-lisp Content-Disposition: attachment; filename=bench.el ;; -*- lexical-binding: t; -*- (require 'shr) (defun bench/git (&rest args) (car (apply 'process-lines "git" "-C" source-directory args))) (defun bench/describe-emacs () (let* ((fork-point (bench/git "merge-base" "--fork-point" "origin/master" emacs-repository-version)) (git-desc (bench/git "show" "--date=short" "--format=format:%cd; %h" fork-point))) (format "%s; %-7s; %s" git-desc emacs-version emacs-repository-branch))) (let ((dom (with-temp-buffer (insert-file-contents "test.html") (libxml-parse-html-region))) (emacs-desc (bench/describe-emacs))) (dolist (val '(nil t)) (setopt shr-fill-text val) (pcase-let ((`(,total-time ,gc-count ,gc-time) (benchmark-run 1000 (with-temp-buffer (shr-insert-document dom))))) (message "%s\tshr-fill-text=%s\t(%6.3f %d %6.3f)" (bench/describe-emacs) shr-fill-text total-time gc-count gc-time)))) --=-=-= Content-Type: application/x-shellscript Content-Disposition: attachment; filename=bench.sh Content-Transfer-Encoding: base64 IyEvYmluL2Jhc2gKCnNldCAtZXV4Cgp3Z2V0IGh0dHBzOi8vZGViYnVncy5nbnUub3JnL0RldmVs b3Blci5odG1sIC1PIHRlc3QuaHRtbAoKYmVuY2ggKCkKewogICAgZm9yIGQgaW4gbWFzdGVyIGhh Y2svc2hyCiAgICBkbwogICAgICAgICIkZCIvc3JjL2VtYWNzIC1iYXRjaCAtUSAtbCBiZW5jaC5l bAogICAgZG9uZQp9CgpiZW5jaCB8JiBjb2x1bW4gLXRzJCdcdCcK --=-=-=--