From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Phil Sainty Newsgroups: gmane.emacs.bugs Subject: bug#58302: 29.0.50; browse-url-emacs is extremely slow (and I think always has been?) Date: Thu, 06 Oct 2022 00:07:25 +1300 Message-ID: <929023db7615cc93faad294e3860ba5f@webmail.orcon.net.nz> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10579"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Orcon Webmail To: 58302@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Oct 05 13:09:58 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 1og2Hl-0002Yy-Nl for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 05 Oct 2022 13:09:57 +0200 Original-Received: from localhost ([::1]:44230 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1og2Hk-0007r4-5w for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 05 Oct 2022 07:09:56 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58756) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1og2Fx-000794-2o for bug-gnu-emacs@gnu.org; Wed, 05 Oct 2022 07:08:06 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56970) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1og2Fv-0006q8-MM for bug-gnu-emacs@gnu.org; Wed, 05 Oct 2022 07:08:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1og2Fu-0006az-Gz for bug-gnu-emacs@gnu.org; Wed, 05 Oct 2022 07:08:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Phil Sainty Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 05 Oct 2022 11:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 58302 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.166496807825340 (code B ref -1); Wed, 05 Oct 2022 11:08:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 5 Oct 2022 11:07:58 +0000 Original-Received: from localhost ([127.0.0.1]:56047 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1og2Fm-0006aa-Kg for submit@debbugs.gnu.org; Wed, 05 Oct 2022 07:07:58 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:35052) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1og2FY-0006aA-24 for submit@debbugs.gnu.org; Wed, 05 Oct 2022 07:07:53 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40640) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1og2FT-0006le-Eu for bug-gnu-emacs@gnu.org; Wed, 05 Oct 2022 07:07:38 -0400 Original-Received: from smtp-2.orcon.net.nz ([60.234.4.43]:48755) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1og2FQ-0006li-Rb for bug-gnu-emacs@gnu.org; Wed, 05 Oct 2022 07:07:35 -0400 Original-Received: from [10.253.37.70] (port=58810 helo=webmail.orcon.net.nz) by smtp-2.orcon.net.nz with esmtpa (Exim 4.90_1) (envelope-from ) id 1og2FM-0001pZ-6X for bug-gnu-emacs@gnu.org; Thu, 06 Oct 2022 00:07:29 +1300 Original-Received: from ip-116-251-140-135.kinect.net.nz ([116.251.140.135]) via [10.253.37.253] by webmail.orcon.net.nz with HTTP (HTTP/1.1 POST); Thu, 06 Oct 2022 00:07:25 +1300 X-Sender: psainty@orcon.net.nz X-GeoIP: -- Received-SPF: pass client-ip=60.234.4.43; envelope-from=psainty@orcon.net.nz; helo=smtp-2.orcon.net.nz X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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" Xref: news.gmane.io gmane.emacs.bugs:244513 Archived-At: browse-url-emacs has always been inexplicably slow for me, since at least Emacs 24 (but maybe just 'always'). I've just done some basic benchmarking with: (benchmark-run (save-selected-window (browse-url-emacs "http://www.example.com"))) ;; If I delete the "www.example.com" buffer after each attempt, this ;; call takes nearly 3 seconds: (2.819470404 1 0.046148434000000016) (2.669529036 0 0.0) (2.837350438 1 0.02421054800000011) ;; If I retain the "www.example.com" buffer, then each retry takes ;; <0.5 seconds: (0.374270464 0 0.0) (0.428719681 0 0.0) (0.476068586 1 0.044311528999999794) ;; Whereas benchmarking only `url-retrieve-synchronously': (benchmark-run (url-retrieve-synchronously "http://www.example.com")) ;; This takes <0.25 seconds. (0.172364234 0 0.0) (0.24314511600000002 0 0.0) (0.19534228 0 0.0) ;; Deleting the network connection via M-x list-processes between ;; attempts adds about 0.25 seconds for all sets of benchmarks, so the ;; network connection time is not a factor. ;; eww is also fast: (benchmark-run (save-window-excursion (let ((eww-retrieve-command 'sync)) (eww "http://www.example.com")))) (0.197008672 0 0.0) (0.25098304499999996 0 0.0) (0.28419454299999997 0 0.0) So something to do with browse-url-emacs is taking an additional 2.5s on top of the basic URL request -- unless the buffer already exists, in which case it's much faster (albeit still twice as slow as the other options). Presumably this could be improved? If I benchmark-progn the final (funcall func url) in browse-url-emacs I can see that this is where all the time is spent. func is set to `find-file-other-window'; so this is equivalent: (benchmark-run (save-selected-window (let ((file-name-handler-alist (cons (cons url-handler-regexp 'url-file-handler) file-name-handler-alist))) (find-file-noselect "http://www.example.com"))) (kill-buffer "www.example.com")) If the buffer already existed, *Messages* says: Contacting host: www.example.com:80 (0.408067329 0 0.0) If the buffer did not already exist, *Messages* says: Contacting host: www.example.com:80 [2 times] File exists, but cannot be read (2.617302471 0 0.0) (The "[2 times]" is not on account of a previous test; they are both generated by this single call.) Benchmarking the end of `find-file-noselect' like so: (benchmark-progn (find-file-noselect-1 buf filename nowarn rawfile truename number)) Gives me: Elapsed time: 1.876737s (0.057295s in 1 GCs) ;; find-file-noselect-1 (2.680159853 1 0.057295379000000146) ;; the overall benchmark-run And that's as far as I've gone. -Phil In GNU Emacs 29.0.50 (build 4, x86_64-pc-linux-gnu, X toolkit, cairo version 1.15.10, Xaw scroll bars) of 2022-07-15 built on phil-lp Repository revision: 00eb894a56d63fad3573a53dd57c323289711512 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12008000 System Description: Ubuntu 18.04.6 LTS Configured using: 'configure --prefix=/home/phil/emacs/trunk/usr/local --with-x-toolkit=lucid --without-sound '--program-transform-name=s/^ctags$/ctags_emacs/'' Configured features: CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG JSON LCMS2 LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP THREADS TIFF TOOLKIT_SCROLL_BARS WEBP X11 XDBE XIM XINPUT2 XPM LUCID ZLIB Important settings: value of $LC_MONETARY: en_NZ.UTF-8 value of $LC_NUMERIC: en_NZ.UTF-8 value of $LC_TIME: en_NZ.UTF-8 value of $LANG: en_GB.UTF-8 value of $XMODIFIERS: @im=ibus locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: savehist-mode: t windmove-mode: t winner-mode: t tooltip-mode: t global-eldoc-mode: t eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug mule-util display-line-numbers dcl-mode tempo mm-archive message sendmail yank-media rfc822 mml mml-sec epa derived epg rfc6068 epg-config gnus-util mailabbrev gmm-utils mailheader mm-decode mm-bodies mm-encode url-dav parse-time iso8601 cl-extra cl-print debug backtrace find-func benchmark shortdoc url-about url-handlers thingatpt help-fns radix-tree help-mode dabbrev time-date textsec uni-scripts idna-mapping ucs-normalize uni-confusable textsec-check mail-utils gnutls network-stream url-http mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr url-gw nsm url-cache url-auth shr text-property-search pixel-fill kinsoku url-file url-dired puny svg xml dom browse-url url url-proxy url-privacy url-expand url-methods url-history url-cookie generate-lisp-file url-domsuf url-util url-parse auth-source cl-seq eieio eieio-core cl-macs password-cache json subr-x map byte-opt gv bytecomp byte-compile cconv url-vars mailcap savehist windmove winner ring dired-aux cl-loaddefs cl-lib dired dired-loaddefs advice rmc iso-transl tooltip eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic indonesian philippine cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting cairo x-toolkit xinput2 x multi-tty make-network-process emacs) Memory information: ((conses 16 210718 27584) (symbols 48 9278 0) (strings 32 47429 2202) (string-bytes 1 1030861) (vectors 16 40826) (vector-slots 8 595360 31429) (floats 8 105 82) (intervals 56 1185 0) (buffers 992 38))