From unknown Sat Sep 20 08:01:34 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#50777 <50777@debbugs.gnu.org> To: bug#50777 <50777@debbugs.gnu.org> Subject: Status: Dropping EIEIO from xref (for performance) Reply-To: bug#50777 <50777@debbugs.gnu.org> Date: Sat, 20 Sep 2025 15:01:34 +0000 retitle 50777 Dropping EIEIO from xref (for performance) reassign 50777 emacs submitter 50777 Dmitry Gutov severity 50777 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 24 09:29:03 2021 Received: (at submit) by debbugs.gnu.org; 24 Sep 2021 13:29:03 +0000 Received: from localhost ([127.0.0.1]:56956 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mTlGA-0004uF-9x for submit@debbugs.gnu.org; Fri, 24 Sep 2021 09:29:03 -0400 Received: from lists.gnu.org ([209.51.188.17]:34540) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mTlFz-0004tk-J3 for submit@debbugs.gnu.org; Fri, 24 Sep 2021 09:29:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58382) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTlFz-0003Vo-Bc for bug-gnu-emacs@gnu.org; Fri, 24 Sep 2021 09:28:51 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]:33343) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mTlFw-0002gV-QG for bug-gnu-emacs@gnu.org; Fri, 24 Sep 2021 09:28:51 -0400 Received: by mail-wr1-x430.google.com with SMTP id t18so27626549wrb.0 for ; Fri, 24 Sep 2021 06:28:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:to:from:subject:message-id:date:user-agent:mime-version :content-language; bh=zoh37vkrJ8pG1pYof/jEIo640Ck0M4EzUOWrzN05gcY=; b=kpdZqxoSoCQczM2YzragcY5I6AVq/lX7qc9dywKefv/cTV1CZcpyRdGRJt2ug59lp3 fF+YaRbBpyUOJWpL+BjX1QYoQvH5YSxWQs8hBwADMjRjFPeiaCrD8naH4XFvghR62Ev8 fgJJ4NjdfNI/cDrcu4nqQXQB6Nod7PWmchici9KJkaFqJqC9qbxsM6B1NJLyZlMB0AXH M0ZlX8L6ygAieJz5HpnxnruQkm5aDT6/aKkkt/J3cgsbmWXkl6qWj54lTnvjXiYrH1V8 UXdq7msiDGnpr/kAUfXOfxpZtbt9o6jwazMEoAGeFxBGtnuq4q9xcaP33O/IQBeRUTJ7 weww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:to:from:subject:message-id:date :user-agent:mime-version:content-language; bh=zoh37vkrJ8pG1pYof/jEIo640Ck0M4EzUOWrzN05gcY=; b=KLDsg5yvpooEvXJdljR0DLoqcxdqZHl3SbA3sbT9OnMWGKJjVt8pYYDj/hkk5BWjrF Yhb5RkiJnD0tni6c6qYtKmDglocGPBRS5FG5jWov93QLDNV9FJ9w6RSngkdhvaT6ezkb 2y7mm5wMl/JAaqRU5aP+EGWPxYP00JopGi+GG0QP58G4ES5K0A0PpjNAO42OwRqPshEW A+p/uerR+9Fq86kLChjk1Jehwshj3xraisw3+rd2lrdoiJH8MYnaxqPeUJpJQZHs31OU AGKeZIZFbmpugra8yLmZDrTMlCkN5xFfs7qxBNP2uNJBMCAbQK0XfjbOXJoRU34oPvgI N48w== X-Gm-Message-State: AOAM531nRRVc5YvklFvy4S7optj2W1GPsf4in0RimSYvGD7WUOkVAmGz SHdGoJdvJ5dfhdl2PldAzMwFkT9TdmM= X-Google-Smtp-Source: ABdhPJymacV8YA7+4VIqZi6+JpsWw45qLGc+W8VvHuG0RUnXbuCLjxN4gmkZI469aH//Mi/Wq8vWqw== X-Received: by 2002:a05:600c:4106:: with SMTP id j6mr2204454wmi.99.1632490126838; Fri, 24 Sep 2021 06:28:46 -0700 (PDT) Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id 20sm13533562wme.46.2021.09.24.06.28.45 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 24 Sep 2021 06:28:46 -0700 (PDT) To: bug-gnu-emacs@gnu.org From: Dmitry Gutov Subject: Dropping EIEIO from xref (for performance) Message-ID: <6b5b14d5-b2ca-8add-f4bf-a3405270c07a@yandex.ru> Date: Fri, 24 Sep 2021 16:28:38 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------2D39B70D301BE44FBA52954B" Content-Language: en-US Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=raaahh@gmail.com; helo=mail-wr1-x430.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.248, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.8 (-) This is a multi-part message in MIME format. --------------2D39B70D301BE44FBA52954B Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Debbugs-CC: Eli Zaretskii , Lars Ingebrigtsen , Stefan Monnier , Daniel Martín , Mattias Engdegård With the recent discussion about our Lisp overhead when the search returns many matches, I went a couple more rounds to try to identify the hotspots. My main benchmark for that is (benchmark 1 '(project-find-regexp "list")) in the Emacs repo. The 3 recent commits have reduced that time from 8s to 6.5s on my machine (under best conditions: warm disk cache and fresh Emacs session). The machine is pretty fast, so I figure we can multiply that timing by 2x, to imagine the average user experience. Having exhausted the obvious steps, I have looked at the difference between defclass and cl-defstruct in this respect. Earlier quick tests indicated there would be little to no difference, but now that I've wrote the full patch, it's significant. The attached patch drops the timing of the above benchmark further down to 4.1s here. Both allocation ('make-instance' vs auto-generated 'xref-make-*' struct constructors) and accessing the fields show increased performance, with the former showing the most improvement: I guess EIEIO's type checking added some extra overhead. That creates some incompatibility (third-party packages can't inherit from 'xref-location' anymore, or use 'make-instance', 'oref' or 'with-slots' with our values), but OTOH a quick survey of existing packages that integrate with Xref shows they wisely don't do that already. Not the largest, popular ones I have reviewed, at least. The ones that do can be updated to rely on the recommended public interface: the xref-make-* constructors and the generic functions to access the data. This will keep the code compatible with both new and previous versions of Xref. I'd like to push it soon, so users of Emacs 28 can enjoy the speedup. What do people think? --------------2D39B70D301BE44FBA52954B Content-Type: text/x-patch; charset=UTF-8; name="xref-from-defclass-to-defstruct.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="xref-from-defclass-to-defstruct.diff" diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el index e6af2b12c7..f53b09d9e8 100644 --- a/lisp/progmodes/etags.el +++ b/lisp/progmodes/etags.el @@ -2161,18 +2161,16 @@ etags--xref-apropos-additional (nreverse res)))) tags-apropos-additional-actions)) -(defclass xref-etags-location (xref-location) - ((tag-info :type list :initarg :tag-info) - (file :type string :initarg :file - :reader xref-location-group)) - :documentation "Location of an etags tag.") +(cl-defstruct (xref-etags-location + (:constructor xref-make-etags-location (tag-info file))) + "Location of an etags tag." + tag-info file) -(defun xref-make-etags-location (tag-info file) - (make-instance 'xref-etags-location :tag-info tag-info - :file (expand-file-name file))) +(cl-defmethod xref-location-group ((l xref-etags-location)) + (xref-etags-location-file l)) (cl-defmethod xref-location-marker ((l xref-etags-location)) - (with-slots (tag-info file) l + (pcase-let (((cl-struct xref-etags-location tag-info file) l)) (let ((buffer (find-file-noselect file))) (with-current-buffer buffer (save-excursion @@ -2182,25 +2180,20 @@ xref-location-marker (point-marker))))))) (cl-defmethod xref-location-line ((l xref-etags-location)) - (with-slots (tag-info) l + (pcase-let (((cl-struct xref-etags-location tag-info) l)) (nth 1 tag-info))) -(defclass xref-etags-apropos-location (xref-location) - ((symbol :type symbol :initarg :symbol) - (goto-fun :type function :initarg :goto-fun) - (group :type string :initarg :group - :reader xref-location-group)) - :documentation "Location of an additional apropos etags symbol.") +(cl-defstruct (xref-etags-apropos-location + (:constructor xref-make-etags-apropos-location (symbol goto-fun group))) + "Location of an additional apropos etags symbol." + symbol goto-fun group) -(defun xref-make-etags-apropos-location (symbol goto-fun group) - (make-instance 'xref-etags-apropos-location - :symbol symbol - :goto-fun goto-fun - :group group)) +(cl-defmethod xref-location-group ((l xref-etags-apropos-location)) + (xref-etags-apropos-location-group l)) (cl-defmethod xref-location-marker ((l xref-etags-apropos-location)) (save-window-excursion - (with-slots (goto-fun symbol) l + (pcase-let (((cl-struct xref-etags-apropos-location goto-fun symbol) l)) (funcall goto-fun symbol) (point-marker)))) diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index fb8090cfb7..fa053bc987 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -78,9 +78,6 @@ xref ;;; Locations -(defclass xref-location () () - :documentation "A location represents a position in a file or buffer.") - (cl-defgeneric xref-location-marker (location) "Return the marker for LOCATION.") @@ -121,19 +118,20 @@ xref-file-name-display ;; FIXME: might be useful to have an optional "hint" i.e. a string to ;; search for in case the line number is slightly out of date. -(defclass xref-file-location (xref-location) - ((file :type string :initarg :file :reader xref-location-group) - (line :type fixnum :initarg :line :reader xref-location-line) - (column :type fixnum :initarg :column :reader xref-file-location-column)) - :documentation "A file location is a file/line/column triple. -Line numbers start from 1 and columns from 0.") +(cl-defstruct (xref-file-location + (:constructor xref-make-file-location (file line column))) + "A file location is a file/line/column triple. +Line numbers start from 1 and columns from 0." + file line column) + +(cl-defmethod xref-location-group ((l xref-file-location)) + (xref-file-location-file l)) -(defun xref-make-file-location (file line column) - "Create and return a new `xref-file-location'." - (make-instance 'xref-file-location :file file :line line :column column)) +(cl-defmethod xref-location-line ((l xref-file-location)) + (xref-file-location-line l)) (cl-defmethod xref-location-marker ((l xref-file-location)) - (with-slots (file line column) l + (pcase-let (((cl-struct xref-file-location file line column) l)) (with-current-buffer (or (get-file-buffer file) (let ((find-file-suppress-same-file-warnings t)) @@ -151,77 +149,45 @@ xref-location-marker (forward-char column)) (point-marker)))))) -(defclass xref-buffer-location (xref-location) - ((buffer :type buffer :initarg :buffer) - (position :type fixnum :initarg :position))) - -(defun xref-make-buffer-location (buffer position) - "Create and return a new `xref-buffer-location'." - (make-instance 'xref-buffer-location :buffer buffer :position position)) +(cl-defstruct (xref-buffer-location + (:constructor xref-make-buffer-location (buffer position))) + buffer position) (cl-defmethod xref-location-marker ((l xref-buffer-location)) - (with-slots (buffer position) l + (pcase-let (((cl-struct xref-buffer-location buffer position) l)) (let ((m (make-marker))) (move-marker m position buffer)))) (cl-defmethod xref-location-group ((l xref-buffer-location)) - (with-slots (buffer) l + (pcase-let (((cl-struct xref-buffer-location buffer) l)) (or (buffer-file-name buffer) (format "(buffer %s)" (buffer-name buffer))))) -(defclass xref-bogus-location (xref-location) - ((message :type string :initarg :message - :reader xref-bogus-location-message)) - :documentation "Bogus locations are sometimes useful to -indicate errors, e.g. when we know that a function exists but the -actual location is not known.") - -(defun xref-make-bogus-location (message) - "Create and return a new `xref-bogus-location'." - (make-instance 'xref-bogus-location :message message)) +(cl-defstruct (xref-bogus-location + (:constructor xref-make-bogus-location (message))) + "Bogus locations are sometimes useful to indicate errors, +e.g. when we know that a function exists but the actual location +is not known." + message) (cl-defmethod xref-location-marker ((l xref-bogus-location)) - (user-error "%s" (oref l message))) + (user-error "%s" (xref-bogus-location-message l))) (cl-defmethod xref-location-group ((_ xref-bogus-location)) "(No location)") ;;; Cross-reference -(defclass xref-item () - ((summary :type string :initarg :summary - :reader xref-item-summary - :documentation "One line which will be displayed for -this item in the output buffer.") - (location :initarg :location - :reader xref-item-location - :documentation "An object describing how to navigate -to the reference's target.")) - :comment "An xref item describes a reference to a location -somewhere.") - -(defun xref-make (summary location) - "Create and return a new `xref-item'. -SUMMARY is a short string to describe the xref. -LOCATION is an `xref-location'." - (make-instance 'xref-item :summary summary :location location)) - -(defclass xref-match-item () - ((summary :type string :initarg :summary - :reader xref-item-summary) - (location :initarg :location - :type xref-location - :reader xref-item-location) - (length :initarg :length :reader xref-match-length)) - :comment "A match xref item describes a search result.") - -(defun xref-make-match (summary location length) - "Create and return a new `xref-match-item'. -SUMMARY is a short string to describe the xref. -LOCATION is an `xref-location'. -LENGTH is the match length, in characters." - (make-instance 'xref-match-item :summary summary - :location location :length length)) +(cl-defstruct (xref-item + (:constructor xref-make (summary location))) + "An xref item describes a reference to a location somewhere." + summary location) + +(cl-defstruct (xref-match-item + (:include xref-item) + (:constructor xref-make-match (summary location length))) + "A match xref item describes a search result." + length) ;;; API @@ -970,7 +936,7 @@ xref--insert-xrefs for max-line-width = (cl-loop for xref in xrefs maximize (let ((line (xref-location-line - (oref xref location)))) + (xref-item-location xref)))) (and line (1+ (floor (log line 10)))))) for line-format = (and max-line-width (format "%%%dd: " max-line-width)) @@ -985,7 +951,7 @@ xref--insert-xrefs (xref--insert-propertized '(face xref-file-header xref-group t) group "\n") (cl-loop for xref in xrefs do - (with-slots (summary location) xref + (pcase-let (((cl-struct xref-item summary location) xref)) (let* ((line (xref-location-line location)) (prefix (cond @@ -1206,22 +1172,23 @@ xref-show-definitions-completing-read (cl-loop for ((group . xrefs) . more1) on xref-alist do (cl-loop for (xref . more2) on xrefs do - (with-slots (summary location) xref - (let* ((line (xref-location-line location)) - (line-fmt - (if line - (format #("%d:" 0 2 (face xref-line-number)) - line) - "")) - (group-prefix - (substring group group-prefix-length)) - (group-fmt - (propertize group-prefix - 'face 'xref-file-header - 'xref--group group-prefix)) - (candidate - (format "%s:%s%s" group-fmt line-fmt summary))) - (push (cons candidate xref) xref-alist-with-line-info))))) + (let* ((summary (xref-item-summary xref)) + (location (xref-item-location xref)) + (line (xref-location-line location)) + (line-fmt + (if line + (format #("%d:" 0 2 (face xref-line-number)) + line) + "")) + (group-prefix + (substring group group-prefix-length)) + (group-fmt + (propertize group-prefix + 'face 'xref-file-header + 'xref--group group-prefix)) + (candidate + (format "%s:%s%s" group-fmt line-fmt summary))) + (push (cons candidate xref) xref-alist-with-line-info)))) (setq xref (if (not (cdr xrefs)) (car xrefs) --------------2D39B70D301BE44FBA52954B-- From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 24 09:35:52 2021 Received: (at 50777) by debbugs.gnu.org; 24 Sep 2021 13:35:52 +0000 Received: from localhost ([127.0.0.1]:56962 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mTlMl-00058P-UZ for submit@debbugs.gnu.org; Fri, 24 Sep 2021 09:35:52 -0400 Received: from mail-wr1-f42.google.com ([209.85.221.42]:37606) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mTlMW-00057l-O8 for 50777@debbugs.gnu.org; Fri, 24 Sep 2021 09:35:50 -0400 Received: by mail-wr1-f42.google.com with SMTP id t8so27659522wrq.4 for <50777@debbugs.gnu.org>; Fri, 24 Sep 2021 06:35:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:subject:from:to:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=u8NX7NsS3X1BzyW/WUrWDUarPxKvvEzm0qDZm1e+mzQ=; b=Ru/iGLAjvjs67wF5+SdnY9JPr4bf+shZoTCT7q6Mg5XXe+vTAPnSLoh4KTRoxi2Jvf QpeKvBA62jmPo12xtjxTrBvO7z+h7AEiG6Hx759QsTg83mP33ltqwzKPPpHUrd6an6Ib HO1LYWFECHQT94tVjDfK9Ts8dAgicO4c9ux3zicyZCpo/jw0mwtnKhHXjeiG0O6t4Veg 2Ol9oEUDzO9EmzW5GJeJi1aBMAYTscKss4MDkihYTA/sFDkK3y1j8PGHeh0S7TnpIecr jUHdsEzHHdMPoUJUT2eXSFtd995Z89hWQ7lxiUo10D8Iuctapq/c/RIUU9OF5RKldtuw Dd6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:subject:from:to:references:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=u8NX7NsS3X1BzyW/WUrWDUarPxKvvEzm0qDZm1e+mzQ=; b=qf92ByQSt4pXtxuoA2cerX2w7ygMWo39vl4DvU788qlIR40Pc7NqValaeVDQn/JKcw 6f7IC5+dPN06wsgsdXotglvJxBumQ9cXkk51PbI/g1dgIhm+Gz20OXBbpE8lbzRyYHaR Gqm7ZDx4qkazilq0jNN07ItSDhLgjyFdZmvLJC9LKV3BnTnXAvuzqrktl/jNqehoq5du EaxO0qi4bN4dljifeAXLmqobw9Za68NpNbAaDU++WX0ArWBOK6ObcDwLVqEIWcBRYwwh hDBIoMpG5Tu+BoaMYt5ajg4FljzFZ5haUx1k1Y4/txhpbfY/8lFohukDNWFCIPFceiGS C63Q== X-Gm-Message-State: AOAM533wJ4xoDeBkXpE4MXLzM/YRP9KAbeIv1lYonuqRKOq2FQJZrmp7 uFI7CyK6KM5O4DMWr3/4sDFB8ubtaPs= X-Google-Smtp-Source: ABdhPJyOwvE8iHfoZ17xA2I6ixvYoIUEnrd5ClsZUdykxPE6vTP0G+0PDiZspfIi+kUrSetI6BOrpQ== X-Received: by 2002:a05:600c:33a6:: with SMTP id o38mr742197wmp.163.1632490530699; Fri, 24 Sep 2021 06:35:30 -0700 (PDT) Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id l124sm12477577wml.8.2021.09.24.06.35.29 for <50777@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 24 Sep 2021 06:35:30 -0700 (PDT) Subject: Re: bug#50777: Dropping EIEIO from xref (for performance) From: Dmitry Gutov To: 50777@debbugs.gnu.org References: <6b5b14d5-b2ca-8add-f4bf-a3405270c07a@yandex.ru> Message-ID: <0e90de09-993a-c11c-f1a3-42b19f581f89@yandex.ru> Date: Fri, 24 Sep 2021 16:35:27 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <6b5b14d5-b2ca-8add-f4bf-a3405270c07a@yandex.ru> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Score: 0.4 (/) X-Debbugs-Envelope-To: 50777 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.6 (/) On 24.09.2021 16:28, Dmitry Gutov wrote: > X-Debbugs-CC: Eli Zaretskii , Lars Ingebrigtsen > , Stefan Monnier , Daniel > Martín , Mattias Engdegård Anybody who wants to argue Debbugs is really usable, check out the Cc it generated from the above string. From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 24 09:37:37 2021 Received: (at 50777) by debbugs.gnu.org; 24 Sep 2021 13:37:37 +0000 Received: from localhost ([127.0.0.1]:56966 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mTlOS-0005CD-NJ for submit@debbugs.gnu.org; Fri, 24 Sep 2021 09:37:37 -0400 Received: from mail-wr1-f44.google.com ([209.85.221.44]:45826) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mTlOQ-0005Bx-KV for 50777@debbugs.gnu.org; Fri, 24 Sep 2021 09:37:35 -0400 Received: by mail-wr1-f44.google.com with SMTP id d21so27498815wra.12 for <50777@debbugs.gnu.org>; Fri, 24 Sep 2021 06:37:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language; bh=ykXdnREya+tqhqQf6aZUXA5NviFCYKLmVqSPPtLUHkU=; b=W3g3NZdOnjKE78BhCeccf5asO6Pv6d+H3AizPK0tlu7NcLlenMZ1A4zBvTHu/2rwI1 zqQI0j+h8BZSi8xXzrDPDAEJ/DlOQneI3D681bq6InfqGpJZFH1TmGkUzpJj8j2OBFiQ KFWF/MjoseP20nnX06VITc9v45vJki+KnasiBJHwmBX0e2dl7Qq0S8WLrx+uOODF6Xf9 3Did0OKj6mfauuED7sXrEwulTP8Z8MP8m52HOCQ1LzaRqkGEOMKlEozgSqIJpqqb8Vih 26jhVc5r+Z8Z2xh3jvy/xThsKLpZXJsUT5dDKB315g7gnu/QQ1kkKA+f2Sq5tfrXTsiP ncvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:subject:from:to:cc:references:message-id :date:user-agent:mime-version:in-reply-to:content-language; bh=ykXdnREya+tqhqQf6aZUXA5NviFCYKLmVqSPPtLUHkU=; b=P5wOtpCxnk7boZAL02vLJLDUHO3ELUYsgeYHqNYYr+QyBtF4jI3yG1+ycjxh+GDVj3 FsKOiGcRQTbqL2+hj/hnXyTOWjUiF6fn8NImjGtjMpwZE5EstEZxrBI+3bKHRpUuwdxd S2PTOZS2qbB6BORe1Yh1DK1JUkG+A8YSiasNnrWyeDwC8ECbDDQsvcwmTFxQDlWgDoCO ISYU39jmZ+tAeyjkAY8fjXBSqxHvGt5OPrE4UHP5LkPHePp1H0tsm4JpvL/eXcHmk63J rI2iPr0ZQwaeFTHPvjqX+0P66ACo0ZoxRqwM1F+dyMa2+G1YYMJwdjRQE8/uHtcBJjUu A+OA== X-Gm-Message-State: AOAM532O7sfHA9MDnXyYHqK2qAEp8MTIDBfec3SW6+geMRQZbelLf5UV d+vyUboHKqG2fvYe6ncnGsY= X-Google-Smtp-Source: ABdhPJzK5Y6dTGvcVu/5sgrqPOlEKb8ViqmOtNIs1J5R/MaSbeiHgWG12s2UpeqPeIUFVCpR/7ISqg== X-Received: by 2002:a05:600c:2d45:: with SMTP id a5mr2159957wmg.39.1632490648753; Fri, 24 Sep 2021 06:37:28 -0700 (PDT) Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id k17sm14257345wmj.0.2021.09.24.06.37.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 24 Sep 2021 06:37:28 -0700 (PDT) Subject: Re: bug#50777: Dropping EIEIO from xref (for performance) From: Dmitry Gutov To: 50777@debbugs.gnu.org References: <6b5b14d5-b2ca-8add-f4bf-a3405270c07a@yandex.ru> Message-ID: Date: Fri, 24 Sep 2021 16:37:25 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <6b5b14d5-b2ca-8add-f4bf-a3405270c07a@yandex.ru> Content-Type: multipart/mixed; boundary="------------3B2DE64690D680AC2A09C773" Content-Language: en-US X-Spam-Score: 0.4 (/) X-Debbugs-Envelope-To: 50777 Cc: =?UTF-8?Q?Mattias_Engdeg=c3=a5rd?= , Stefan Monnier , =?UTF-8?Q?Daniel_Mart=c3=adn?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.6 (/) This is a multi-part message in MIME format. --------------3B2DE64690D680AC2A09C773 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Resending with the intended recipients (except for the maintainers who are automatically subscribed anyway, to spare the inboxes). With the recent discussion about our Lisp overhead when the search returns many matches, I went a couple more rounds to try to identify the hotspots. My main benchmark for that is (benchmark 1 '(project-find-regexp "list")) in the Emacs repo. The 3 recent commits have reduced that time from 8s to 6.5s on my machine (under best conditions: warm disk cache and fresh Emacs session). The machine is pretty fast, so I figure we can multiply that timing by 2x, to imagine the average user experience. Having exhausted the obvious steps, I have looked at the difference between defclass and cl-defstruct in this respect. Earlier quick tests indicated there would be little to no difference, but now that I've wrote the full patch, it's significant. The attached patch drops the timing of the above benchmark further down to 4.1s here. Both allocation ('make-instance' vs auto-generated 'xref-make-*' struct constructors) and accessing the fields show increased performance, with the former showing the most improvement: I guess EIEIO's type checking added some extra overhead. That creates some incompatibility (third-party packages can't inherit from 'xref-location' anymore, or use 'make-instance', 'oref' or 'with-slots' with our values), but OTOH a quick survey of existing packages that integrate with Xref shows they wisely don't do that already. Not the largest, popular ones I have reviewed, at least. The ones that do can be updated to rely on the recommended public interface: the xref-make-* constructors and the generic functions to access the data. This will keep the code compatible with both new and previous versions of Xref. I'd like to push it soon, so users of Emacs 28 can enjoy the speedup. What do people think? --------------3B2DE64690D680AC2A09C773 Content-Type: text/x-patch; charset=UTF-8; name="xref-from-defclass-to-defstruct.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="xref-from-defclass-to-defstruct.diff" diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el index e6af2b12c7..f53b09d9e8 100644 --- a/lisp/progmodes/etags.el +++ b/lisp/progmodes/etags.el @@ -2161,18 +2161,16 @@ etags--xref-apropos-additional (nreverse res)))) tags-apropos-additional-actions)) -(defclass xref-etags-location (xref-location) - ((tag-info :type list :initarg :tag-info) - (file :type string :initarg :file - :reader xref-location-group)) - :documentation "Location of an etags tag.") +(cl-defstruct (xref-etags-location + (:constructor xref-make-etags-location (tag-info file))) + "Location of an etags tag." + tag-info file) -(defun xref-make-etags-location (tag-info file) - (make-instance 'xref-etags-location :tag-info tag-info - :file (expand-file-name file))) +(cl-defmethod xref-location-group ((l xref-etags-location)) + (xref-etags-location-file l)) (cl-defmethod xref-location-marker ((l xref-etags-location)) - (with-slots (tag-info file) l + (pcase-let (((cl-struct xref-etags-location tag-info file) l)) (let ((buffer (find-file-noselect file))) (with-current-buffer buffer (save-excursion @@ -2182,25 +2180,20 @@ xref-location-marker (point-marker))))))) (cl-defmethod xref-location-line ((l xref-etags-location)) - (with-slots (tag-info) l + (pcase-let (((cl-struct xref-etags-location tag-info) l)) (nth 1 tag-info))) -(defclass xref-etags-apropos-location (xref-location) - ((symbol :type symbol :initarg :symbol) - (goto-fun :type function :initarg :goto-fun) - (group :type string :initarg :group - :reader xref-location-group)) - :documentation "Location of an additional apropos etags symbol.") +(cl-defstruct (xref-etags-apropos-location + (:constructor xref-make-etags-apropos-location (symbol goto-fun group))) + "Location of an additional apropos etags symbol." + symbol goto-fun group) -(defun xref-make-etags-apropos-location (symbol goto-fun group) - (make-instance 'xref-etags-apropos-location - :symbol symbol - :goto-fun goto-fun - :group group)) +(cl-defmethod xref-location-group ((l xref-etags-apropos-location)) + (xref-etags-apropos-location-group l)) (cl-defmethod xref-location-marker ((l xref-etags-apropos-location)) (save-window-excursion - (with-slots (goto-fun symbol) l + (pcase-let (((cl-struct xref-etags-apropos-location goto-fun symbol) l)) (funcall goto-fun symbol) (point-marker)))) diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index fb8090cfb7..fa053bc987 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -78,9 +78,6 @@ xref ;;; Locations -(defclass xref-location () () - :documentation "A location represents a position in a file or buffer.") - (cl-defgeneric xref-location-marker (location) "Return the marker for LOCATION.") @@ -121,19 +118,20 @@ xref-file-name-display ;; FIXME: might be useful to have an optional "hint" i.e. a string to ;; search for in case the line number is slightly out of date. -(defclass xref-file-location (xref-location) - ((file :type string :initarg :file :reader xref-location-group) - (line :type fixnum :initarg :line :reader xref-location-line) - (column :type fixnum :initarg :column :reader xref-file-location-column)) - :documentation "A file location is a file/line/column triple. -Line numbers start from 1 and columns from 0.") +(cl-defstruct (xref-file-location + (:constructor xref-make-file-location (file line column))) + "A file location is a file/line/column triple. +Line numbers start from 1 and columns from 0." + file line column) + +(cl-defmethod xref-location-group ((l xref-file-location)) + (xref-file-location-file l)) -(defun xref-make-file-location (file line column) - "Create and return a new `xref-file-location'." - (make-instance 'xref-file-location :file file :line line :column column)) +(cl-defmethod xref-location-line ((l xref-file-location)) + (xref-file-location-line l)) (cl-defmethod xref-location-marker ((l xref-file-location)) - (with-slots (file line column) l + (pcase-let (((cl-struct xref-file-location file line column) l)) (with-current-buffer (or (get-file-buffer file) (let ((find-file-suppress-same-file-warnings t)) @@ -151,77 +149,45 @@ xref-location-marker (forward-char column)) (point-marker)))))) -(defclass xref-buffer-location (xref-location) - ((buffer :type buffer :initarg :buffer) - (position :type fixnum :initarg :position))) - -(defun xref-make-buffer-location (buffer position) - "Create and return a new `xref-buffer-location'." - (make-instance 'xref-buffer-location :buffer buffer :position position)) +(cl-defstruct (xref-buffer-location + (:constructor xref-make-buffer-location (buffer position))) + buffer position) (cl-defmethod xref-location-marker ((l xref-buffer-location)) - (with-slots (buffer position) l + (pcase-let (((cl-struct xref-buffer-location buffer position) l)) (let ((m (make-marker))) (move-marker m position buffer)))) (cl-defmethod xref-location-group ((l xref-buffer-location)) - (with-slots (buffer) l + (pcase-let (((cl-struct xref-buffer-location buffer) l)) (or (buffer-file-name buffer) (format "(buffer %s)" (buffer-name buffer))))) -(defclass xref-bogus-location (xref-location) - ((message :type string :initarg :message - :reader xref-bogus-location-message)) - :documentation "Bogus locations are sometimes useful to -indicate errors, e.g. when we know that a function exists but the -actual location is not known.") - -(defun xref-make-bogus-location (message) - "Create and return a new `xref-bogus-location'." - (make-instance 'xref-bogus-location :message message)) +(cl-defstruct (xref-bogus-location + (:constructor xref-make-bogus-location (message))) + "Bogus locations are sometimes useful to indicate errors, +e.g. when we know that a function exists but the actual location +is not known." + message) (cl-defmethod xref-location-marker ((l xref-bogus-location)) - (user-error "%s" (oref l message))) + (user-error "%s" (xref-bogus-location-message l))) (cl-defmethod xref-location-group ((_ xref-bogus-location)) "(No location)") ;;; Cross-reference -(defclass xref-item () - ((summary :type string :initarg :summary - :reader xref-item-summary - :documentation "One line which will be displayed for -this item in the output buffer.") - (location :initarg :location - :reader xref-item-location - :documentation "An object describing how to navigate -to the reference's target.")) - :comment "An xref item describes a reference to a location -somewhere.") - -(defun xref-make (summary location) - "Create and return a new `xref-item'. -SUMMARY is a short string to describe the xref. -LOCATION is an `xref-location'." - (make-instance 'xref-item :summary summary :location location)) - -(defclass xref-match-item () - ((summary :type string :initarg :summary - :reader xref-item-summary) - (location :initarg :location - :type xref-location - :reader xref-item-location) - (length :initarg :length :reader xref-match-length)) - :comment "A match xref item describes a search result.") - -(defun xref-make-match (summary location length) - "Create and return a new `xref-match-item'. -SUMMARY is a short string to describe the xref. -LOCATION is an `xref-location'. -LENGTH is the match length, in characters." - (make-instance 'xref-match-item :summary summary - :location location :length length)) +(cl-defstruct (xref-item + (:constructor xref-make (summary location))) + "An xref item describes a reference to a location somewhere." + summary location) + +(cl-defstruct (xref-match-item + (:include xref-item) + (:constructor xref-make-match (summary location length))) + "A match xref item describes a search result." + length) ;;; API @@ -970,7 +936,7 @@ xref--insert-xrefs for max-line-width = (cl-loop for xref in xrefs maximize (let ((line (xref-location-line - (oref xref location)))) + (xref-item-location xref)))) (and line (1+ (floor (log line 10)))))) for line-format = (and max-line-width (format "%%%dd: " max-line-width)) @@ -985,7 +951,7 @@ xref--insert-xrefs (xref--insert-propertized '(face xref-file-header xref-group t) group "\n") (cl-loop for xref in xrefs do - (with-slots (summary location) xref + (pcase-let (((cl-struct xref-item summary location) xref)) (let* ((line (xref-location-line location)) (prefix (cond @@ -1206,22 +1172,23 @@ xref-show-definitions-completing-read (cl-loop for ((group . xrefs) . more1) on xref-alist do (cl-loop for (xref . more2) on xrefs do - (with-slots (summary location) xref - (let* ((line (xref-location-line location)) - (line-fmt - (if line - (format #("%d:" 0 2 (face xref-line-number)) - line) - "")) - (group-prefix - (substring group group-prefix-length)) - (group-fmt - (propertize group-prefix - 'face 'xref-file-header - 'xref--group group-prefix)) - (candidate - (format "%s:%s%s" group-fmt line-fmt summary))) - (push (cons candidate xref) xref-alist-with-line-info))))) + (let* ((summary (xref-item-summary xref)) + (location (xref-item-location xref)) + (line (xref-location-line location)) + (line-fmt + (if line + (format #("%d:" 0 2 (face xref-line-number)) + line) + "")) + (group-prefix + (substring group group-prefix-length)) + (group-fmt + (propertize group-prefix + 'face 'xref-file-header + 'xref--group group-prefix)) + (candidate + (format "%s:%s%s" group-fmt line-fmt summary))) + (push (cons candidate xref) xref-alist-with-line-info)))) (setq xref (if (not (cdr xrefs)) (car xrefs) --------------3B2DE64690D680AC2A09C773-- From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 24 10:49:35 2021 Received: (at 50777) by debbugs.gnu.org; 24 Sep 2021 14:49:35 +0000 Received: from localhost ([127.0.0.1]:59020 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mTmW7-0001q1-3k for submit@debbugs.gnu.org; Fri, 24 Sep 2021 10:49:35 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:46983) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mTmW4-0001pl-V9 for 50777@debbugs.gnu.org; Fri, 24 Sep 2021 10:49:33 -0400 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id D4EFC100261; Fri, 24 Sep 2021 10:49:26 -0400 (EDT) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 4DB2410017A; Fri, 24 Sep 2021 10:49:25 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1632494965; bh=C+XQd/XtiLTlr7ryM3i0c/6DFW0XwqKvKqysVwUSRek=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=NzP5jik34hR89JhWW2AxIxwqWD5czt6Df++mI85cm8DbwGObGrt3KB3SQjtSOhLp5 rG74wLsyBZ2V7JV2qnhcHoFyuj5BfpQlfkIGHFpbQBO04mU5SS3X4cIIqGfDPwCirq 6A09LqKZATiAsV/lqk5CEgroFOPgl80rQnHY4lUYYY714ks76PNQ+uBxEz5f77A5KA P4/Mb1nL3GL5/btPf/CfQPRhJlUf2d6je0E8lsTwZu+AI3soxfm0u4HYhvXIp0O/NS vLWErRZiCKpacku8xYEv+EwLok/rHMO0WfQvnPK5PlofxVtA5K79XHjNvaX61Nk0+N KdVhHFv6aSoxw== Received: from milanesa (unknown [45.72.241.23]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 07D4C1201CA; Fri, 24 Sep 2021 10:49:24 -0400 (EDT) From: Stefan Monnier To: Dmitry Gutov Subject: Re: bug#50777: Dropping EIEIO from xref (for performance) Message-ID: References: <6b5b14d5-b2ca-8add-f4bf-a3405270c07a@yandex.ru> Date: Fri, 24 Sep 2021 10:49:24 -0400 In-Reply-To: (Dmitry Gutov's message of "Fri, 24 Sep 2021 16:37:25 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.055 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 50777 Cc: Mattias =?windows-1252?Q?Engdeg=E5rd?= , 50777@debbugs.gnu.org, Daniel =?windows-1252?Q?Mart=EDn?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > That creates some incompatibility (third-party packages can't inherit from > 'xref-location' anymore, or use 'make-instance', 'oref' or 'with-slots' with > our values), About that: it should be fairly easy to get `make-instance`, `oref`, and `with-slots` to work with cl-defstruct objects/classes. This should be easy enough that we *could* potentially consider doing those changes "right away" (i.e. for Emacs-28). As for the inheritance, they can still inherit from `xref-location` but: - not with `defclass` (the subclass needs to be defined with `cl-defstruct` instead). - they can't inherit from both `xref-location` and something else any more. The second restriction could potentially be lifted without too much work (we could allow multiple inheritance as long as only one of the parents has fields, a bit like Java allows only one parent but multiple interfaces where interfaces can be though of "classes without fields"). I think the first restriction can be lifted as well under the constraint that `defclass` can only inherit from a single defstruct class that should be the first parent (since its fields need to be placed at the very beginning of the object). But I don't think those two additional changes would be in scope of Emacs-28. Stefan From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 24 11:12:57 2021 Received: (at 50777) by debbugs.gnu.org; 24 Sep 2021 15:12:57 +0000 Received: from localhost ([127.0.0.1]:59040 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mTmsi-0002Xd-QY for submit@debbugs.gnu.org; Fri, 24 Sep 2021 11:12:57 -0400 Received: from mail-oln040092071079.outbound.protection.outlook.com ([40.92.71.79]:5540 helo=EUR03-DB5-obe.outbound.protection.outlook.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mTmsg-0002XJ-An for 50777@debbugs.gnu.org; Fri, 24 Sep 2021 11:12:55 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YpeFwVJ1wBzhnSzP8KHiDexCYxr83nLHrrlyS7n4AiZPwD/nnnvBoNvCISxNYkfM+GyuzwpcZ0b05lQovz/f4QFJbGWnLEGl9JWMuAHw7YQRLjcLWELpQVqWODeXVR8OD+G1XuQnaBNir7nAcjTnd1C8bbI3IN5g8tGMvqVZwsYb4bkwDGW22AY2PDgEhbO0kNMDeGsHQZ6OO6AMiuHbrU57vmUxsdcYBLwOSCCLAtC3AuCX7DQTEDRh2lbCP6dpzeEJQMnv5l/pxbVG70AD/aEmKH75JKxLzmSquD22C/gpRUWVfcbH3zgKCDI6IAktibB85KIj268T1tHM1gqJCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=UGe8Py7mBFvztrzM3RedlRP9I5meWTRZgo8eWmoJdR8=; b=Is0/UBBWBg5UDN87X2gGB5NnDymSViwxXop5IGS9BDLUTw6mJPa+LiaXqJfU5YrxFdMKB+gYMTe8QLMfi6cWtabMAeYz04lEpR0+z1UlmmoXDy2hvFG1+P9wMHTb6WDZwKJg/2jaVpVkJCJjL2T/xh7SwiQ4mpaT7m6+UoxjRTBn/N7mFR2DiyTrPINW2SwgJxseGohYGIslJEdXZk2uS5zwxbm2AWhtS9hiHiNcSkV/ySdyf7Ha7ICLWH8gPhvzYudakouMvRWbuBe3LgouzyR96NtNxgur28Lds2Vw822tdqe/lNTXWBpQR3Ej1cTtY9BGiOAwtbapuhLDaKN7wA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UGe8Py7mBFvztrzM3RedlRP9I5meWTRZgo8eWmoJdR8=; b=DkcokgehbopffZ0vrTkLQ02pqtV2m/xNwA3DcADqhWkRCfkEGrr8ZpyxLJ74BtPpqihTrfYeQ+PeQOhiPU6Yk8PctOWHm9dOiWG/KKosVm7uCSefEEnWRd5rO43HyvOZnXsIQA8hFbKhrJ1CpmkgS+toRJT5yL59nqxgoI6CWN9TdxxYoFhgjR+f/YZdZBA2YDd++vWjZ/J2JpAiMaPVL/CkcXdWs7fwILHR9bhyML7KYePY8GlEuRv4irw1p/WHcW5pHs+yVSscB/0unJe4RWC/CvttnWJrc81If60rSN1+w5HE4PMtAVkpCSzUhlgNGcf1IauVV4QkX1S2JkZFxg== Received: from AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) by AM9PR09MB4740.eurprd09.prod.outlook.com (2603:10a6:20b:286::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13; Fri, 24 Sep 2021 15:12:48 +0000 Received: from AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::c55c:ece5:bed2:a9dc]) by AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::c55c:ece5:bed2:a9dc%9]) with mapi id 15.20.4544.018; Fri, 24 Sep 2021 15:12:48 +0000 From: Arthur Miller To: Dmitry Gutov Subject: Re: bug#50777: Dropping EIEIO from xref (for performance) References: <6b5b14d5-b2ca-8add-f4bf-a3405270c07a@yandex.ru> Date: Fri, 24 Sep 2021 17:12:46 +0200 In-Reply-To: (Dmitry Gutov's message of "Fri, 24 Sep 2021 16:37:25 +0300") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Content-Type: text/plain X-TMN: [237wEClieCwrl8QNb4np7G92NG9M7Gop] X-ClientProxiedBy: HE1PR0402CA0028.eurprd04.prod.outlook.com (2603:10a6:7:7c::17) To AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) X-Microsoft-Original-Message-ID: <87o88ic8i9.fsf@live.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from pascal.homepc (81.232.177.30) by HE1PR0402CA0028.eurprd04.prod.outlook.com (2603:10a6:7:7c::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13 via Frontend Transport; Fri, 24 Sep 2021 15:12:47 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: df84bea4-a7e2-46ff-c303-08d97f6dc493 X-MS-TrafficTypeDiagnostic: AM9PR09MB4740: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: i+4+EEGANeSDwEDCnEZnduL2h0k4FZLcxZq0Mr4xTW4nuId1VoQhhUOZFyeO2AlI/IMfiiVYpJ9pvonbHPCV7Gbs+kUQtvUbyOeod1fOMN4HyH074jSbEUIYudbcunK6ltM2qlyzrxXdwR52YlmYuoK/RbGzeUbdG8hVGntVDUfQycHGVbB/qqZOvDBcieWfedu2fcMIyIU05K/GMPnP6FymBVNT9njaoNp5OVVeTSVm+Vp13bupD+rmXtoC5qE1+XMy5R+XUMyKg1bOx8x8HL0JYFszXu806Eo+enOe6eWH/B6Nh+chYrVvPsh5gC9GnTj8SV/24yl2z88uNm22zMkkzJ8awB6EQWpgieluahGHJ2eW/Ste6O7SiflE1YHXk1ZBSc6uiL+izwxhiFKKBBgATMwcFJkXT/4pR09Oajc0yM5wVGw4wNUfC3G8GUO2 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: c3jtJF1nXeSJz0d3gy/uplqk5jkSNKg1yYASuk7BDLLulnTYtnJlAxsCg+su59CWcQH3TqaFRDyfqtcKqspnfMorV9sxZK5awcwMu7ImUE0lil4HGsCgzA9wmQ8xvM6lzTRhLNdqSYHnyE81XJXG3Q== X-OriginatorOrg: sct-15-20-3174-20-msonline-outlook-72e6e.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: df84bea4-a7e2-46ff-c303-08d97f6dc493 X-MS-Exchange-CrossTenant-AuthSource: AM9PR09MB4977.eurprd09.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Sep 2021 15:12:48.1442 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR09MB4740 X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 50777 Cc: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= , 50777@debbugs.gnu.org, Stefan Monnier , Daniel =?utf-8?Q?Mart=C3=ADn?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Dmitry Gutov writes: > Resending with the intended recipients (except for the maintainers who are > automatically subscribed anyway, to spare the inboxes). > > With the recent discussion about our Lisp overhead when the search returns many > matches, I went a couple more rounds to try to identify the hotspots. > > My main benchmark for that is > > (benchmark 1 '(project-find-regexp "list")) > > in the Emacs repo. The 3 recent commits have reduced that time from 8s to 6.5s > on my machine (under best conditions: warm disk cache and fresh Emacs > session). The machine is pretty fast, so I figure we can multiply that timing by > 2x, to imagine the average user experience. > > Having exhausted the obvious steps, I have looked at the difference between > defclass and cl-defstruct in this respect. Earlier quick tests indicated there > would be little to no difference, but now that I've wrote the full patch, it's > significant. > > The attached patch drops the timing of the above benchmark further down to 4.1s > here. > > Both allocation ('make-instance' vs auto-generated 'xref-make-*' struct > constructors) and accessing the fields show increased performance, with the > former showing the most improvement: I guess EIEIO's type checking added some > extra overhead. > > That creates some incompatibility (third-party packages can't inherit from > 'xref-location' anymore, or use 'make-instance', 'oref' or 'with-slots' with our > values), but OTOH a quick survey of existing packages that integrate with Xref > shows they wisely don't do that already. Not the largest, popular ones I have > reviewed, at least. > > The ones that do can be updated to rely on the recommended public interface: the > xref-make-* constructors and the generic functions to access the data. This will > keep the code compatible with both new and previous versions of Xref. > > I'd like to push it soon, so users of Emacs 28 can enjoy the speedup. > > What do people think? Yes please. From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 24 11:32:50 2021 Received: (at 50777) by debbugs.gnu.org; 24 Sep 2021 15:32:50 +0000 Received: from localhost ([127.0.0.1]:59070 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mTnBy-0003Ad-6D for submit@debbugs.gnu.org; Fri, 24 Sep 2021 11:32:50 -0400 Received: from mail-wr1-f49.google.com ([209.85.221.49]:35593) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mTnBw-0003AM-6y for 50777@debbugs.gnu.org; Fri, 24 Sep 2021 11:32:48 -0400 Received: by mail-wr1-f49.google.com with SMTP id i23so28774958wrb.2 for <50777@debbugs.gnu.org>; Fri, 24 Sep 2021 08:32:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=+LMMsF766wc1kJcrAXWU+VV+MdNHK4StNTVzpPRcR+w=; b=bMmPOqaDb/6jHNIVA17K4bbWafvnKjTKh3QMwjjqaypL2Xd2RFMV8lmzlsOZ6QtxJo JMUnyRgJ4jJkIsZz2t+iK3RcMnFC2AcVC/vZkq+/1cgX+pLhPxIrWdBp0xL9M5dJLVvO oabtr/rsztLuHORMpK3kT2LSVCB0LtXdc/r3eMnE+mNHSAYQ5UeEo9KJNjJRucbOi3N6 PHOGdTlenxXq7KxJGDv1NYEAKtcZ4p73SRWF23fq8DtuGwLflRsvBFnnpDOuebx+DcbC fcrFPjZ1qWbbSJ4KFJJXYkc+H7/vGX8vhCubB5IHuslXKtc6zpgs/6dj6wZkJO2nR83O 1BeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=+LMMsF766wc1kJcrAXWU+VV+MdNHK4StNTVzpPRcR+w=; b=g2keoNY2Cm/cHkjso4tiyYb82BMGzMLtrKz3ksfKzNUGjqjhrYV2p1sTq5MuA7o0St 9G7b062kN7L0DU+2PbBJo9GZprNhW7i9Pm79sgtnICJhfHG1FaWV5SAz+q7rI3A78ONa oN8u7mvQQVIinjG2C02kGL5oSsgXYOjCr0ysAPIyNlBU7ElXuh2LeuhY1vbEElpTYKGt yUtFHjbiGXJTquMjDtGSr+hf/3kTFfBgtMjpm1q0pfUBXceD4icKB3XRj1ldkvdcyIq/ cvkjPM4jC8W5eWp2ssvPNJvJXTUfcilBC3jSMMYwaLGhdnJSJw6C5/OE4R19EkIV1/X5 bu/A== X-Gm-Message-State: AOAM531uyFiY6SZ/scifSpuZ2G9H6NczBf0rp2wWHFDBPRSYpHX2B6TC MIeSj7bTy/5m+8lwUUZt+RE= X-Google-Smtp-Source: ABdhPJxA+F8FJ8bV5t6TX/Sa6y7aYYFDC53YvtasbDv5h6JzmaQPYfoi+YByn+/AbqQz1wYTqOySVA== X-Received: by 2002:a1c:f002:: with SMTP id a2mr2706389wmb.79.1632497562313; Fri, 24 Sep 2021 08:32:42 -0700 (PDT) Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id m4sm12982253wml.28.2021.09.24.08.32.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 24 Sep 2021 08:32:41 -0700 (PDT) Subject: Re: bug#50777: Dropping EIEIO from xref (for performance) To: Stefan Monnier References: <6b5b14d5-b2ca-8add-f4bf-a3405270c07a@yandex.ru> From: Dmitry Gutov Message-ID: Date: Fri, 24 Sep 2021 18:32:39 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 0.4 (/) X-Debbugs-Envelope-To: 50777 Cc: =?UTF-8?Q?Mattias_Engdeg=c3=a5rd?= , 50777@debbugs.gnu.org, =?UTF-8?Q?Daniel_Mart=c3=adn?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.6 (/) On 24.09.2021 17:49, Stefan Monnier wrote: >> That creates some incompatibility (third-party packages can't inherit from >> 'xref-location' anymore, or use 'make-instance', 'oref' or 'with-slots' with >> our values), > > About that: it should be fairly easy to get `make-instance`, `oref`, and > `with-slots` to work with cl-defstruct objects/classes. > > This should be easy enough that we *could* potentially consider doing > those changes "right away" (i.e. for Emacs-28). Interesting point. Not sure we really want to: I imagine the removal of the use of 'make-instance' contributed to the overall performance improvement. If I'm right, discouraging of its use (for this particular purpose) in third-party code seems like a good idea. > As for the inheritance, they can still inherit from `xref-location` but: > - not with `defclass` (the subclass needs to be defined with `cl-defstruct` > instead). > - they can't inherit from both `xref-location` and something else any more. There is no 'xref-location' structure, it's only defined by generic functions. I think that's better. 'xref-location' has always been a class with empty definition. One area of bigger concern is whether code compiled against the new version of Xref would work with the old one without recompiling (and vice versa). I guess for that to work we need to disable inlining on xref-item's accessors, at least. Maybe there's something else I'm missing. From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 24 21:43:09 2021 Received: (at 50777) by debbugs.gnu.org; 25 Sep 2021 01:43:09 +0000 Received: from localhost ([127.0.0.1]:59765 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mTwib-0006Yc-4l for submit@debbugs.gnu.org; Fri, 24 Sep 2021 21:43:09 -0400 Received: from quimby.gnus.org ([95.216.78.240]:33870) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mTwiY-0006YA-Ac for 50777@debbugs.gnu.org; Fri, 24 Sep 2021 21:43:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=ioh9ms9EPnjwv7KCmoynMYwFe2Nc8hU2L+EXBkB1gAE=; b=vEeShKisNi1TY+bHzVQNbxV8r2 pwBp31yreVdk9c2w/hhblymc1mcooqSRmyuJnmWBss3ZpzK0s5aACV2/cgVhlVu+VQe2IIL3FMIQL t3uPVfQW+v+1UEpL5gpt/TFy1F9Ef3M0zliGGuCB1HLEuJasbCJniNm28NuotKj2CW14=; Received: from [84.212.220.105] (helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mTwiL-00085y-Jj; Sat, 25 Sep 2021 03:42:55 +0200 From: Lars Ingebrigtsen To: Dmitry Gutov Subject: Re: bug#50777: Dropping EIEIO from xref (for performance) References: <6b5b14d5-b2ca-8add-f4bf-a3405270c07a@yandex.ru> Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAG1BMVEU+RoM3R4Uscq4n hsItS41TWpOwr8o1iL7///9ogBk0AAAAAWJLR0QIht6VegAAAAd0SU1FB+UJGQEHAOTfpgUAAAGs SURBVDjLdZNLcoMwDIbJDWJad49c2nWtCex7A+iYPcngrBtm8PUr+QFOQkVMHH2W5N+xikI824FG sQfYikMJoJAGBNNK00sciwO8VgDvJXxDJQDKqvScQPVcgdLQgL0KIPIIabp9YITMAUgjDZuggI6/ AxBgognZmYknlFCJwtTR3wljhlGGKQNng9E6Y6eYlXQMGRjsFLNSDbusgFLR43MxaLaIt8EOIabc wEQChxX4VBd7ZUDirJkGS+6+zoCVspNm9AA8aC6uZeAPy1jeWAAfF2xjcSKSgTqFiBk9CEc7rGC5 IPpdxTM3D0AkQARjKpy9jPX/6vHU+4gZFzvmQNes3HrQZeBH16lGY/Ob0OsoEPFj+ge0d8Ak0GI7 5qBOOtoZfzN/qTOQ39MXDAKXc3vDrwyoFSCizgAmQLtCteUq6ecqMA9R92AN4QCsVRTIVm1+ijim CDLuoFJl4KxQaepP1BCXRHDzLas2N6Vl0MzeC/TB1jlHY44ANT6YB8uVlrlb7P8KPmnaMXDpTse2 5A7rWaDzpoC2xbVoD5omfBlSd6zd7ht3H3RH8QdZYeMm+rfuuwAAACV0RVh0ZGF0ZTpjcmVhdGUA MjAyMS0wOS0yNVQwMTowNzowMCswMDowMFTYEMIAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMjEtMDkt MjVUMDE6MDc6MDArMDA6MDAlhah+AAAAAElFTkSuQmCC X-Now-Playing: Brigid Mae Power's _Head Above the Water_: "Head Above The Water" Date: Sat, 25 Sep 2021 03:42:52 +0200 In-Reply-To: (Dmitry Gutov's message of "Fri, 24 Sep 2021 16:37:25 +0300") Message-ID: <87lf3lqvkz.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Dmitry Gutov writes: > The ones that do can be updated to rely on the recommended public > interface: the xref-make-* constructors and the generic functions to > access the data. This will keep the code compatible with bo [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 50777 Cc: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= , 50777@debbugs.gnu.org, Stefan Monnier , Daniel =?utf-8?Q?Mart=C3=ADn?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Dmitry Gutov writes: > The ones that do can be updated to rely on the recommended public > interface: the xref-make-* constructors and the generic functions to > access the data. This will keep the code compatible with both new and > previous versions of Xref. > > I'd like to push it soon, so users of Emacs 28 can enjoy the speedup. > > What do people think? Speedups would be nice, but I think this sounds like a very big change to make to such a central system (that I think many third-party packages rely on) at this point, so I'm leaning towards it being in Emacs 29 instead. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 24 21:53:02 2021 Received: (at 50777) by debbugs.gnu.org; 25 Sep 2021 01:53:02 +0000 Received: from localhost ([127.0.0.1]:59784 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mTwsA-0000aV-3F for submit@debbugs.gnu.org; Fri, 24 Sep 2021 21:53:02 -0400 Received: from mail-wr1-f49.google.com ([209.85.221.49]:34781) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mTws7-0000a8-45 for 50777@debbugs.gnu.org; Fri, 24 Sep 2021 21:53:01 -0400 Received: by mail-wr1-f49.google.com with SMTP id t8so32772327wri.1 for <50777@debbugs.gnu.org>; Fri, 24 Sep 2021 18:52:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=oaGjD9gQ3SfevElzr0fbLeilR4IsEpBIYIqzLjdYZow=; b=MBVoS3k7Y0ztmJUYqGVODH5PUypu3xYAHraNlEJzwErM50/4FhSBaVE7S8Ydh8YlVJ pnoqGlGLs3cGSy26iGbR3SwPdUa6PxnAn4v584Xx0+i49twp/QqPb2IPNTX7/f9dsqwr vqHxkxQKyHCo7dNOugIajg2f0Yj58Fn9tYGJj6FOMCZWMGbnd4qiduXwvHJPNLuoCovr 1XEx9x5LEppN74O801MYoCPmjRzbooEYaO3ZlnKgVewaBP2QoXoJGNa4nvVG/aVWnw+P TUIgnqdt76dzzBDBhkZf4wd/sMn7TdfGYizlwFPIseS2AMK8chxOV2VhmnAQfzSzKgtZ Hy2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=oaGjD9gQ3SfevElzr0fbLeilR4IsEpBIYIqzLjdYZow=; b=pxbf+K8eiYiQLURpeaim4HNDL2y9wl7n0Z0gzvutOrYBOPPR4fvGez//vZJ4EoHgJl doTByesg4DcYS/XmEHNo7l4FYSpJDO9syIF2dtaJTSN8sFXaun79W7tlGfKTo3sU69i0 vodJQnOSLa7UCFBbpSkDaYOC0xnstbzDPMGWqoxl+UR2Z1N2vGnlSoY2WoSFHz3MdOiV Mb30vzrYNHvMe60tyaGdooqeCmXueXomUgaFCPCM9E32XMA4slzSh8zlRquY7YRnMyzA m2Jn1tn0rJlg7E91Erir0qCkuX/u8mP0aOZCvX9w1PGO8gJjNWWb2LQTUiHNbvU8BXe6 5F8Q== X-Gm-Message-State: AOAM5319pO6Rns9G/pmhGTxSMZ3qq4+YRCnCM6QxMlWzlnYICq48nf5B NMKqsx9htjdQGKTeVcaeeJU= X-Google-Smtp-Source: ABdhPJyZ/cZVZ8vyQ3WBWat8LIJ7yPexv8R56/S4nCA6ukO6aJhY/VqbPB74N49k6ritS8wBSdmRag== X-Received: by 2002:adf:f988:: with SMTP id f8mr14700089wrr.54.1632534773161; Fri, 24 Sep 2021 18:52:53 -0700 (PDT) Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id r26sm7964668wmh.35.2021.09.24.18.52.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 24 Sep 2021 18:52:52 -0700 (PDT) Subject: Re: bug#50777: Dropping EIEIO from xref (for performance) To: Lars Ingebrigtsen References: <6b5b14d5-b2ca-8add-f4bf-a3405270c07a@yandex.ru> <87lf3lqvkz.fsf@gnus.org> From: Dmitry Gutov Message-ID: <938468d9-4fd4-e719-b52c-72199989f177@yandex.ru> Date: Sat, 25 Sep 2021 04:52:49 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <87lf3lqvkz.fsf@gnus.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 0.4 (/) X-Debbugs-Envelope-To: 50777 Cc: =?UTF-8?Q?Mattias_Engdeg=c3=a5rd?= , 50777@debbugs.gnu.org, Stefan Monnier , =?UTF-8?Q?Daniel_Mart=c3=adn?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.6 (/) On 25.09.2021 04:42, Lars Ingebrigtsen wrote: > Speedups would be nice, but I think this sounds like a very big change > to make to such a central system (that I think many third-party packages > rely on) at this point, so I'm leaning towards it being in Emacs 29 > instead. Xref is an "ELPA core" package. As soon as we make this change on master and bump the version, it will affect the third-party packages right away. Not when Emacs 29 is released, year(s) later. On the flip side, we can make the change now, bump the version, and be reasonably certain that when Emacs 28 comes out, the third-party packages are already updated for the version that comes with it. It's also the most reliable way to work out the kinks that I know of. From debbugs-submit-bounces@debbugs.gnu.org Sat Sep 25 10:07:53 2021 Received: (at 50777) by debbugs.gnu.org; 25 Sep 2021 14:07:53 +0000 Received: from localhost ([127.0.0.1]:34273 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mU8LJ-000813-C9 for submit@debbugs.gnu.org; Sat, 25 Sep 2021 10:07:53 -0400 Received: from sonic311-30.consmr.mail.ir2.yahoo.com ([77.238.176.162]:41260) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mU8LH-00080n-DU for 50777@debbugs.gnu.org; Sat, 25 Sep 2021 10:07:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.es; s=s2048; t=1632578864; bh=AIsrWaQ7IPNiN9Y+aOCcaCWs7CzSiAzjx7hMUja8rsM=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From:Subject:Reply-To; b=mJiW2SQmInCQwoX7u/xIzhh8BvhhaOdEgBAq2HtDTDyjDpJWgLpa1RrcKbLljyccJkh6Jn7e4gkQIgS6Mcz/v/wXDiD7o8sWknDW05qW4eYkp4Di+XxJeYGyheYMRj9L1FQm5ZZaIu1ILs5UnqCMC/B8qUMaZDwHf/fYyKshdECB9aZv7VrRqLPE1W3PtYxchYeQi9BXGcXW5Gju+I55y1LRQFO+3uBEQQgo5to4qMT7NyU6VcQ4Bf+iNVQe9kxcnk0lHRBFPA0/MaCb4CUcB+yOI1v70kLoOS5Gy5JOl6Wtm5FQpqoDp69fEwGFk9malRGest1uOZh4Fp0C1n+YtA== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1632578864; bh=XanE1o09QTei8p0Sv66z1ZPcgHga6xZINiatJJCsjHx=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=hIsdWdoc/8GgQpc3Ev9ta8LHObuBy6MYZuuZEXgd62bfc74fXrXDBtMPFicRBG8bIRjRDSPo8BmpoNytX8seavFjxX/8ohMJBi2ZLRV28X7nMTbKvU6b8QRALtOzBUQ73ajoIObcUuzyiPytP/AgIjMo0h2DQZX1okqMp1vFObKh12DPKBjVY1lBxygYLYi5AR8m3IFfymrETCCDNKWcv36uKwxNrJQhRX696pm4SaT71iSF4Y5Gav0BTlLsmKvDDuJcfGJlfXHZXjhsrFf+SMXrUzWbrNKzSpw8xRESbM1g6WllUDwrKUUVXlj1U84hA6QQ9NDvUuTWJnxAyfgs3Q== X-YMail-OSG: e7LlSCsVM1mrVuBZ0ClJNOOWSPSs_yPbcC8GBc2Rp4oD9B7rlepiX.CaM1uWIG9 DSqDPYKvrw95rCFFJXyFMdav3FGiWpn0YZ6yztPb2lOrDnGI9BDPHT6FFys.5fSx1VBwH965oO5Z lQI43RqFLYmNbyBNQn_jhyRF4Vdw5LMYOP1s.N28boIHR0w9wxUCUtpUzj3nvpcoJB0wNvKWVzGE .RlntEUCCFG7xbxvwLNJWDIkhTa6LR0dWiht2YX8RJUEnOguF_qNKJtuynx9VVAoj0Yd4RkKupqx Fwv0Lrn7wswxssqMG4cr_oMM8HZgREVw7b7Xx2CY3.029fJ4noN269QLPDJPTl6mXi3jwdkQaWRG yJsWxRZLRw7wZcB85yV2N36781wJe8kwe2j0b2rEEu7q4YURwG028P2ns7buNAEehQAp8QAYwMfl Ya3PceMOnnuDGLgP7jkK9o_8GyHMU.LQDhu0uE.FiWH2T.WSNUnSGC4F19R1oKx09oYbkRgsrJkh vuNQ1aMMbHyTt_xJKhdPJodzP0C9rCFcRiByf6uo57oDeVZYKMGaCLTt_.gfkK6hpfae349TkCJH VPtaL_IJIQPjYxCbHFZbuoqMw4hLGMGPDllbUgtLqVuEFhYgpF66hTnKCf6MWK_XRSQ8Ne1vVxrS LPYPVoBpHAEyzYsSr7pmrprDR2xzE18jrUS0yWpR4312l1wyC8D5S0XpYXmk.zLAhrsP03HJ9PmD r6dBZnJzM1mKezAIuLZG8W2cbiTWdNEdXqHG7sUYkucUeHJNcFVX1JyP5D0idv_04oboLrd3XhqR Oq4q3ANrlYW.ZFdhmsnzORP0GR6tHcYq0.vQIk..l0e.vQSB3SHQpZx8dm5PqA3ToIy3RjXLUZLz jd5zwfH1rn5UjrCBcN6rQq92D_1o6gb5hVMBNoFMpu6LrVyeLoSfMnBC3d2CWHrNLKqrbZeeOhov zSp5pLkWDcukB213Bgjj7VjnNacLGdoAFM8EWrmEEd1.P_DiYeDry1qx9GqmD7FqbON4z8M9ZFr6 WFhEZgKp8ZrS21nxZbXc9fKVPyasbYBDMI5cRzNDoVzEG2xT3NYAzis0lhqBnCGAu9H75nLfcOzj oyvNFJ_xGEtbWIdhMC81v3WPnGCJyYhkWGThEwtlqH.7gv6Qup66yJ49ntaBr29raqKuYmLZrwui HLYk27A.Y2I9wHwOzB9rUQE_rBnt5DbJ_ypVExkJzj6sXj0Ja_SJsVPQUprfUkl8vGac5YkFoJk6 0YOffPmL.YUhRR8OVZCc7TZYVEri0FXVPeOdwOcxEhcVlhaUA6ePQ6MmygLtviHZEP.Vu0P_5kGi 0yx1jLMVGjGzAl7bjNahSt8s46RlgjQ9o6ka8OYQGz.2yHa7bXhkxQulsoemQocqxelWJOvnCEmy yikwfU_udNVIxYlgX0_rdQWih1wtqeP1icJdEkbb.Lj5iCmIiJhXnpz7gFgrQlZNa2MUZY7K72Z9 2KhKH.KGaykSFvU_wKKQRXiz0a1ZWfoXuka.ZEP4rNHplSIsO8GZcZBez2Ag8fJ7PLlOJYccMxej N3G_LczrVdpQEOfIyEAIv5IeLMjMqTy_PThXDDHWdMrzyO5ixKdjGSyN6AsoYYAErMun1mSstNom gdPXI4LIBcGoeFIORXyKTg8hZ1nhA6UQ.lMsvB2RthNIVEhQL2whzUj796PbuNLOVhZT8EQ4yS7B qELUy5u.FFzzPbgO8piiNi4FBWeL2.HEmkaHzsE5ZHO_WAH2mn7qeY3DOoNe1MD2AmMjIozsn3N7 fm_pQsKdjYK0DzoX7HLVkFSLIKl6J46YkWDwjmS2AOByQgnBWeaJpSmySlCJbqtvLrf17AVjNOHJ bHe7Gw84c3_LVgHu6pMBgZ_IbQI6_sdwFr8EKR0rnDg8jxQsBsEEI8.OPJmKT2xEJuO3jj6gEIN3 c3vODKalsfuge68o_s6IedDJcoim920FI3Tupn5W.EN3crb.tXSawpZvleHrxbiG8tBWapb7JbDb fG5Uk3TAGTk7cdZLER9NBREsVKBW0rRblBPu_CP.vZiNrIj4we0xGhpfISdkba2QTT5PbtkISIeK opND1qgQFAGABEK.pmfflIXso3LgNRpUKH97hpfWv5rZo3jeZWcIa4qKPGn7yyT3CG7Lr40XOL5n T_DZoKSIvHVUn808ABM4CHpzr3CRPwfyQb3WH8tt5CpKEHZQb_FPl_vkwClaIJSxWba19y7fRVsd uu6tcT8_vmWIz6sm4WbQRAhEYnx7.5wkoA4QqIhs7l4wPigaR0WSsHOEsIn4vMCfjnso- X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic311.consmr.mail.ir2.yahoo.com with HTTP; Sat, 25 Sep 2021 14:07:44 +0000 Received: by kubenode505.mail-prod1.omega.ir2.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 4df65f0bc38d17a5ee8c2ef66255811f; Sat, 25 Sep 2021 14:07:41 +0000 (UTC) From: =?utf-8?Q?Daniel_Mart=C3=ADn?= To: Dmitry Gutov Subject: Re: bug#50777: Dropping EIEIO from xref (for performance) References: <6b5b14d5-b2ca-8add-f4bf-a3405270c07a@yandex.ru> Date: Sat, 25 Sep 2021 16:07:40 +0200 In-Reply-To: (Dmitry Gutov's message of "Fri, 24 Sep 2021 16:37:25 +0300") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (darwin) MIME-Version: 1.0 Content-Type: text/plain X-Mailer: WebService/1.1.19043 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Content-Length: 1323 X-Spam-Score: 0.2 (/) X-Debbugs-Envelope-To: 50777 Cc: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= , 50777@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.8 (/) Dmitry Gutov writes: > Resending with the intended recipients (except for the maintainers who > are automatically subscribed anyway, to spare the inboxes). > > With the recent discussion about our Lisp overhead when the search > returns many matches, I went a couple more rounds to try to identify > the hotspots. > > My main benchmark for that is > > (benchmark 1 '(project-find-regexp "list")) > > in the Emacs repo. The 3 recent commits have reduced that time from 8s > to 6.5s on my machine (under best conditions: warm disk cache and > fresh Emacs session). The machine is pretty fast, so I figure we can > multiply that timing by 2x, to imagine the average user experience. Thanks for working on this. I checked the patch and I also see a similar speedup in my system, working with a large monorepo. > > I'd like to push it soon, so users of Emacs 28 can enjoy the speedup. > > What do people think? I agree with Lars, it's better not to rush this change. The change is invasive and I think I was the only person to report a performance problem so far in that part of the codebase. I guess it's better to merge this just after the Emacs 28 branch is cut, so that users in a stable version are not affected by any potential bug/interface incompatibility not caught during pretest. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Sat Sep 25 21:15:38 2021 Received: (at 50777) by debbugs.gnu.org; 26 Sep 2021 01:15:38 +0000 Received: from localhost ([127.0.0.1]:35191 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mUIlV-00056t-UZ for submit@debbugs.gnu.org; Sat, 25 Sep 2021 21:15:38 -0400 Received: from mail-wr1-f43.google.com ([209.85.221.43]:35656) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mUIlT-00056h-OV for 50777@debbugs.gnu.org; Sat, 25 Sep 2021 21:15:36 -0400 Received: by mail-wr1-f43.google.com with SMTP id i23so39554809wrb.2 for <50777@debbugs.gnu.org>; Sat, 25 Sep 2021 18:15:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=gJMSU/uEMZ7+5EApmZDKZi0fBkIv7F/NGO06rOTGf7E=; b=KKVVc3agYjhjhODfpS9QgeSMOAWLuT1isi7lkSkO3kye35Y9xZTR57wD+NnJPR/knG xqQZpJinwP+YNfX61wfmcNcLb/jIVw8p0QpqP4fqJqze+oqG2FVDeYpMrcAhqH5W2jb4 HUdRSBBKzKTO0p4T/LTT+/pAizabm7jl/oKosQbIOBYkCKl+WZW/MxOUifXnmhPzERHH +pU6JgwZvnVv768OjbXeXCjlVH0K3UOPunygcrlNNHDaLvW+iZgQY8M9b926t+ULJJAX QLdbNYCcTBbZ1CClzcP0vmhfp0K8oCygBhWQk6XIg7Stlu8q7BgwT/JqoXP3OO4ctYzT 479Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:subject:from:to:cc:references:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=gJMSU/uEMZ7+5EApmZDKZi0fBkIv7F/NGO06rOTGf7E=; b=nE53Bnps2RtEGQofdfYPSoR44zwo+rO/zJm/5T8l8FyHnk5zKAbTN3fNhKyULg0Su9 LthJ+UliW5loPZxDzwEeEf0kN0IzjIFl1y8F+iec9M02Mq1l+nOE7MmoMCHYU4TILM6a UgPv30567rZ7gFjUKSdOmq4xxEF0C7aHLl41QeV/RWxNHtaAZlpslVpa8nwRe5bdANhW jZTCaf7l57br3JJSgo47E4Za+zwLwB9KtCbjMcJ+L/WPX93zpij9nN4frdfflRBoE3ik vPSsRdH5LVTOiRCOr3I1Kvs7YY0RcJlIHSaSd9zSLtyjkx3jsfv/84NP9J1zjllBZeBO iUcQ== X-Gm-Message-State: AOAM533fKWCVoFCLY7WJk9V4uXZS4nkeKDE4GP9CuJEAbqB54rOuCEx+ kebYtCo1/zXBsfdaEsVBlGQ= X-Google-Smtp-Source: ABdhPJxAHApminbbIIulgCN5XE68lgWNPHcYLEZXi6I3UIREILXOMD85BFZcaRbJIfy7pfD8E6wUjA== X-Received: by 2002:a5d:6dad:: with SMTP id u13mr19028700wrs.55.1632618930024; Sat, 25 Sep 2021 18:15:30 -0700 (PDT) Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id n66sm12592271wmn.2.2021.09.25.18.15.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 25 Sep 2021 18:15:29 -0700 (PDT) Subject: Re: bug#50777: Dropping EIEIO from xref (for performance) From: Dmitry Gutov To: Stefan Monnier References: <6b5b14d5-b2ca-8add-f4bf-a3405270c07a@yandex.ru> Message-ID: <508ef22b-02e2-c67b-3e34-be47d22f3328@yandex.ru> Date: Sun, 26 Sep 2021 04:15:27 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 0.4 (/) X-Debbugs-Envelope-To: 50777 Cc: =?UTF-8?Q?Mattias_Engdeg=c3=a5rd?= , 50777@debbugs.gnu.org, =?UTF-8?Q?Daniel_Mart=c3=adn?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.6 (/) On 24.09.2021 18:32, Dmitry Gutov wrote: > One area of bigger concern is whether code compiled against the new > version of Xref would work with the old one without recompiling (and > vice versa). I guess for that to work we need to disable inlining on > xref-item's accessors, at least. Maybe there's something else I'm missing. OK, so I've done some testing with ivy-xref (fixing it to stop using with-slots), and (:noinline t) indeed seems necessary for Emacs using previous version of xref to run code from ivy-xref.elc compiled with the newer version without errors. But since I tested this in Emacs 27, (void-function make-closure) was a much bigger problem. This is apparently how lambdas are compiled now. So this is a +1 minor reason to release the new version together with Emacs 28: less need to worry about :noinline. Though we could use it anyway, to avoid tying byte code to a particular implementation: the performance seems unchanged. From debbugs-submit-bounces@debbugs.gnu.org Sat Sep 25 22:16:43 2021 Received: (at 50777) by debbugs.gnu.org; 26 Sep 2021 02:16:43 +0000 Received: from localhost ([127.0.0.1]:35227 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mUJid-0006YY-93 for submit@debbugs.gnu.org; Sat, 25 Sep 2021 22:16:43 -0400 Received: from mail-wr1-f41.google.com ([209.85.221.41]:40828) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mUJia-0006YK-Ua for 50777@debbugs.gnu.org; Sat, 25 Sep 2021 22:16:41 -0400 Received: by mail-wr1-f41.google.com with SMTP id t28so26342275wra.7 for <50777@debbugs.gnu.org>; Sat, 25 Sep 2021 19:16:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=Ps2DUxbRZUT+7E279Zklt8grSTpAPPwG8n2nUDmXmoM=; b=WCp9CJYR6zY/rz7EK/yxaRLwJ8n5T1i7pdSG7ITxKfnAvah3BpGs09+V9CQyNZMqrq 6lPLjP+6DPvM0NqluWYQB1vIipIYETPVVSOklL6yRD6PAcOGwKyA6h+Xb2zi0Bmbk7Wn XkXWNI7ouqXIAmk/gcsX/gjjX4aSmqVmGfS/dvBMNwzncVowxVC861jHYQ0fI0MHsONl 0OfEGHvXxapwKs2RsjUNwTIn+K7n5GfRrWa3i1qhPqtqP35YcpRg8Nx5DLBWC+B8rH61 02jNWUCfOWcRToivKBtBg/QutJ9wIOT0Bb0n9EjOHcFHxFgB136xODkrxCEwds2ORxLH Fg8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Ps2DUxbRZUT+7E279Zklt8grSTpAPPwG8n2nUDmXmoM=; b=kWriL7XiEMd4vWaN9kHw896V9zKcW1ztHDYdIFneF+33+lTWkKGOx7SMXOVjUD1hHL avpVWv5JBanju5ViwQwfH4zTS8DdjX2IoS5MI/J7Il+YV5gG31B1pDm/Q0uX+7txDdX1 48VgwDdCtwmrrkiX743LMdKYutx+xOW8XjNYcVoq178GHigZ1SugktFbN20B9r3B5ao+ aA5oSD4q0iOtZSzKtjz7DGsuw8l0n9kwZweiT/NE/4nFd78JtLY1RMiQdMKdt3Frv/+F xXMqZqNHxLBuRAyFUHnhZqgpwYZCX+hx3ZgHOWtL9DkfRBVahIP74E9njRKMxWy5xW6W 80rg== X-Gm-Message-State: AOAM531H+fztbIUqYdS748o25B/5qLwteatst4gmQzooBT+y8FxXa0KT iuCEOb3trtlSGgyv8aJPZ3g= X-Google-Smtp-Source: ABdhPJx25AqebP2GK+7VTX3HJVAx5rBmm9ND9j6VYnF6NrLI68GlboEbMwZNlpWsCUg4FfficLCEtA== X-Received: by 2002:a5d:6902:: with SMTP id t2mr18896927wru.23.1632622595074; Sat, 25 Sep 2021 19:16:35 -0700 (PDT) Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id z7sm12534816wmi.43.2021.09.25.19.16.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 25 Sep 2021 19:16:34 -0700 (PDT) Subject: Re: bug#50777: Dropping EIEIO from xref (for performance) To: =?UTF-8?Q?Daniel_Mart=c3=adn?= References: <6b5b14d5-b2ca-8add-f4bf-a3405270c07a@yandex.ru> From: Dmitry Gutov Message-ID: Date: Sun, 26 Sep 2021 05:16:31 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Score: 0.4 (/) X-Debbugs-Envelope-To: 50777 Cc: =?UTF-8?Q?Mattias_Engdeg=c3=a5rd?= , 50777@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.6 (/) On 25.09.2021 17:07, Daniel Martín wrote: > Thanks for working on this. I checked the patch and I also see a > similar speedup in my system, working with a large monorepo. Thanks for checking. Could you also do some benchmarking with GNU Grep, as requested in bug#50733? > I agree with Lars, it's better not to rush this change. The change is > invasive and I think I was the only person to report a performance > problem so far in that part of the codebase. I guess it's better to > merge this just after the Emacs 28 branch is cut, so that users in a > stable version are not affected by any potential bug/interface > incompatibility not caught during pretest. Thanks. It has been a known issue for a while, with repeated passes at improving its performance (the "many matches" scenario). Yours has been the second report I've received in the last couple of weeks. I suppose it makes sense to be careful, but the only incompatible packages I have found so far are helm-xref and ivy-xref, both only using with-slots (copied verbatim from xref--insert-xrefs, I guess). It's easy to fix, and the latter can mostly be replaced with the use of xref-show-definitions-completing-read these days. Maybe both of them can. From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 26 04:51:25 2021 Received: (at 50777) by debbugs.gnu.org; 26 Sep 2021 08:51:25 +0000 Received: from localhost ([127.0.0.1]:35771 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mUPsb-0002M6-5Q for submit@debbugs.gnu.org; Sun, 26 Sep 2021 04:51:25 -0400 Received: from mail1464c50.megamailservers.eu ([91.136.14.64]:42732 helo=mail268c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mUPsY-0002Lp-Rd for 50777@debbugs.gnu.org; Sun, 26 Sep 2021 04:51:24 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1632646275; bh=xzFvayywh7J82snlMZc6N8/1/xW3MW8a7siDE0X9qLQ=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=PAuiQ+i8RnPxUEm9ZaC0ls0S4qMuqtIYoWK3Nru9dlXG4465KTQc5WDks6tX6xPIm qjFM6lcPhduEgFMHNwqfEKdVe4zoYTIMGX1+g47cO6d7cXDbhT6YxJ7xS4/5791J56 8QJAtK435sg36EqDJxrp2HKtcU7vyIO09JdPdBYA= Feedback-ID: mattiase@acm.or Received: from [192.168.0.4] (c188-150-171-71.bredband.tele2.se [188.150.171.71]) (authenticated bits=0) by mail268c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 18Q8pCeY009681; Sun, 26 Sep 2021 08:51:14 +0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.21\)) Subject: Re: bug#50777: Dropping EIEIO from xref (for performance) From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= In-Reply-To: <508ef22b-02e2-c67b-3e34-be47d22f3328@yandex.ru> Date: Sun, 26 Sep 2021 10:51:12 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <1060904C-43A4-4981-9E29-5859AD9AB4A5@acm.org> References: <6b5b14d5-b2ca-8add-f4bf-a3405270c07a@yandex.ru> <508ef22b-02e2-c67b-3e34-be47d22f3328@yandex.ru> To: Dmitry Gutov X-Mailer: Apple Mail (2.3445.104.21) X-CTCH-RefID: str=0001.0A742F1C.61503483.0037, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.4 cv=QcUFAuXv c=1 sm=1 tr=0 ts=61503483 a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=kj9zAlcOel0A:10 a=M51BFTxLslgA:10 a=vaJtXVxTAAAA:8 a=HrfVorVYT8mNPzdq544A:9 a=CjuIK1q_8ugA:10 X-Origin-Country: SE X-Spam-Score: 1.4 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: 26 sep. 2021 kl. 03.15 skrev Dmitry Gutov : > (void-function make-closure) > > was a much bigger problem. This is apparently how lambdas are compiled now. There are no circumstances under which Emacs 28 bytecode is guaranteed to work in earlier Emacs versions: there is backward but no forward compatibility. For example, any code using `with-temp-buffer` [...] Content analysis details: (1.4 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.4 KHOP_HELO_FCRDNS Relay HELO differs from its IP's reverse DNS X-Debbugs-Envelope-To: 50777 Cc: 50777@debbugs.gnu.org, Stefan Monnier , =?utf-8?Q?Daniel_Mart=C3=ADn?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) 26 sep. 2021 kl. 03.15 skrev Dmitry Gutov : > (void-function make-closure) >=20 > was a much bigger problem. This is apparently how lambdas are compiled = now. There are no circumstances under which Emacs 28 bytecode is guaranteed = to work in earlier Emacs versions: there is backward but no forward = compatibility. For example, any code using `with-temp-buffer` won't = work, nor as you noticed anything creating closures. This is unavoidable and the alternative would be much worse, but it's = sometimes annoying when testing code with different versions and (in = particular) installing packages using a new version and then using an = old one. Could we arrange the .el file to be used if the .elc is built with a = newer Emacs version? (Perversely, it would make some inlined functions = faster...) An alternative would be to segregate installed packages by (major) = version, so that ~/.emacs.d/ has separate installations for Emacs 26, = 27, 28 and so on. From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 26 14:34:21 2021 Received: (at 50777) by debbugs.gnu.org; 26 Sep 2021 18:34:21 +0000 Received: from localhost ([127.0.0.1]:38775 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mUYyj-0003hQ-61 for submit@debbugs.gnu.org; Sun, 26 Sep 2021 14:34:21 -0400 Received: from mail-wr1-f53.google.com ([209.85.221.53]:43999) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mUYyg-0003hA-MV for 50777@debbugs.gnu.org; Sun, 26 Sep 2021 14:34:19 -0400 Received: by mail-wr1-f53.google.com with SMTP id x20so565072wrg.10 for <50777@debbugs.gnu.org>; Sun, 26 Sep 2021 11:34:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=qIVx7apE48amd6JoRsVfOeLoNepnFP84cTHl+W3qY6k=; b=DgMHvIQxns1aMRoSaqt5+Eu1T/lsjw9cT84SmcrdNR4ukmt1zDPeLMg+a5gabukOT8 bLZObfgqPLsQgRlYjJc9xapvjyhX7yhgYQDeEdhVktzA4B1+TcyMkEJM35zV8YO5pthW /fcuwqEbl49Rngq6omCpzzXgrI2DV3QsNVbZxQDHCgroTJMo0XrU7D3SCZLgeV5ItKy6 o/e1/7nqBzOdKEWcSI4vC1KwTYEIrRnk2ggOyMlekmvZy0SpWQ8KuxsZU+hCh3s+Mqdy ZANwgTU+cEl1uVbqpzw+QZ21fYfDfVc+HVzYfQc89rthbnOg+LfD2yHNn4miFdo3lgJ4 Pl3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=qIVx7apE48amd6JoRsVfOeLoNepnFP84cTHl+W3qY6k=; b=z50H/5VFlO2jHSjXaEClYurpiR68TMCSnPcs93fhdGRfaItTdry/bdNEdAf6dlw9x3 ZBAkKSvGsHNUb5v53oB65l2oa0O/Ns0xPOa7M9+VofyoFzfBJCht4ITV3xk7PIe5pAoe i3p78z6deP74wUO7opUaSB1VITyxaNsrEsQqIlf5paT1WVG506hZFPuo3yvMVyruki1l ixQgmw9VFj9zebTXoRCTBbyKcCwvUPkKh0cXIJ4vmXF0ssoIhlyhJdkNZagxgBzvckmd RHsupla5KlhKxY7TaZWhPbn+pMGuao0AER3yXUUseoTng1wPIMm2zeNs38kfKPIpY5H9 M4cA== X-Gm-Message-State: AOAM5325+pbOioHeKSHIhFR03v5E3heVMfUeHcNxfiAmJatMtYfATN/0 xmPWE+1cGTQo/01TjfoFZSo= X-Google-Smtp-Source: ABdhPJw7hVB6v23Yqh/PBMIimXa0es1++Qrroe/sQyI7E4MUaeVSU1gmBzJ9kaj2ilbuNcKTvhEVHw== X-Received: by 2002:a1c:7e10:: with SMTP id z16mr12659486wmc.141.1632681252631; Sun, 26 Sep 2021 11:34:12 -0700 (PDT) Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id 15sm5750634wmk.48.2021.09.26.11.34.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 26 Sep 2021 11:34:12 -0700 (PDT) Subject: Re: bug#50777: Dropping EIEIO from xref (for performance) To: =?UTF-8?Q?Mattias_Engdeg=c3=a5rd?= References: <6b5b14d5-b2ca-8add-f4bf-a3405270c07a@yandex.ru> <508ef22b-02e2-c67b-3e34-be47d22f3328@yandex.ru> <1060904C-43A4-4981-9E29-5859AD9AB4A5@acm.org> From: Dmitry Gutov Message-ID: Date: Sun, 26 Sep 2021 21:34:10 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <1060904C-43A4-4981-9E29-5859AD9AB4A5@acm.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Score: 0.4 (/) X-Debbugs-Envelope-To: 50777 Cc: 50777@debbugs.gnu.org, Stefan Monnier , =?UTF-8?Q?Daniel_Mart=c3=adn?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.6 (/) On 26.09.2021 11:51, Mattias Engdegård wrote: > 26 sep. 2021 kl. 03.15 skrev Dmitry Gutov : > >> (void-function make-closure) >> >> was a much bigger problem. This is apparently how lambdas are compiled now. > > There are no circumstances under which Emacs 28 bytecode is guaranteed to work in earlier Emacs versions: there is backward but no forward compatibility. For example, any code using `with-temp-buffer` won't work, nor as you noticed anything creating closures. It's all right. Sometimes the compiled code is compatible, but sometimes it's not. We could introduce format versions, maybe. Though it's hard to draw the line because it's probably not the byte-code format itself that changed, but simply certain representations of primitives. I was just saying that pushing that change now might allow us to stop worrying about a particular incompatibility. But we'll probably disable inlining for xref-item accessors anyway, to allow a similar migration to another underlying data format in the future. Just in case. > This is unavoidable and the alternative would be much worse, but it's sometimes annoying when testing code with different versions and (in particular) installing packages using a new version and then using an old one. True. > Could we arrange the .el file to be used if the .elc is built with a newer Emacs version? (Perversely, it would make some inlined functions faster...) Sometimes it will be faster, but sometimes much slower (2x or more). I'm not sure what's the best solution here. Maybe loading .el files *and* nagging the user once per session to recompile their packages could work. > An alternative would be to segregate installed packages by (major) version, so that ~/.emacs.d/ has separate installations for Emacs 26, 27, 28 and so on. Sounds clunky, but maybe it's the right choice. Or maybe move only the compiled files to a separate directory (or directories), and version them by byte-code format. Or major Emacs version. From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 30 17:10:18 2021 Received: (at 50777-done) by debbugs.gnu.org; 30 Sep 2021 21:10:18 +0000 Received: from localhost ([127.0.0.1]:54178 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mW3Jq-0006L7-6Y for submit@debbugs.gnu.org; Thu, 30 Sep 2021 17:10:18 -0400 Received: from mail-lf1-f43.google.com ([209.85.167.43]:37626) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mW3Jn-0006Ko-40 for 50777-done@debbugs.gnu.org; Thu, 30 Sep 2021 17:10:17 -0400 Received: by mail-lf1-f43.google.com with SMTP id i4so31111822lfv.4 for <50777-done@debbugs.gnu.org>; Thu, 30 Sep 2021 14:10:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:subject:from:to:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=52KNMDQov3H39aQcOLa29x2LpPq13CVX4ymBbvX8Wc4=; b=nGB6UDQfcOEbgvWwHUDGtLicPcfTvsCq2Zb7T8JiWwnSJR3F6IMYB42U/W5/Jw17yI y0xjRvTaXUPM5ITfoMDs2nCiTRVRhpKFoNSwAQQ/MsJhjeoDEOBOYkO03hjFQB+WaKZd yLMW91RDFmyOhwC/cOFHIDoALMrzmejK0d49aU85/nGMxKo3/kLCbeCEky3CvaYVLC2b FE8CE2IAZ116Nw/TTyCQA82l3SsKtWOyrazYI0LIBw2YIr4tkbXH7T5phaLg6rkewEvl dMXDqcLW+nW+MSLR241/QNDPcPudP1ftQDcN9bqth5/H0vCTbcSfPccB2sOpiydILTdY /Wfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:subject:from:to:references:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=52KNMDQov3H39aQcOLa29x2LpPq13CVX4ymBbvX8Wc4=; b=4iaQdtmA41NRL4h361MSVyW5VadTEeVeuBo/HpbFwwpYRFxnx5A4KSZEtd/jCrrrv2 U/+VBpdNmC0kvpkqVrJUVzyzeJORX15Vi8j6y7Vnab2VRTNonZlgN2ZS7yIXmM8N4nag XC/pLSSt5nL+3NYW2TNgU6jafolmOkW154DJLV4Aw1/JJ1wpfKgYD1pnT+W1oifyLoJe oafT4rEeIkODN/3Lh5+VO6JeCXRtGXRf/2z2B+LvFzKm+XRbHpp2jlbYTYzZC82FbhtB iTD6Z4EGitvM/XdzOvVSlDjHOe2D9CizWAJsz7PQwf77y/WJjDiXTkyp4HZi3OEMRgzn qWCg== X-Gm-Message-State: AOAM530w7gyyGMKS09s2du1DGLPzA9cYlCx9Or9zJmWd0EqXRuG3zXwW z6YNNW6WzE6kNks7XInwvAVzkTa3NEkryw== X-Google-Smtp-Source: ABdhPJxBMtvj8gPPphdEYV/2ufrOGOXlX67wOzZZXvcc8LP7Nch2XF356Tts1HYuIww/ZeF6Bn3zaw== X-Received: by 2002:a05:651c:989:: with SMTP id b9mr7625318ljq.136.1633036208921; Thu, 30 Sep 2021 14:10:08 -0700 (PDT) Received: from [192.168.1.113] ([178.252.127.239]) by smtp.googlemail.com with ESMTPSA id 10sm492097lfr.153.2021.09.30.14.10.07 for <50777-done@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 30 Sep 2021 14:10:08 -0700 (PDT) Subject: Re: bug#50777: Dropping EIEIO from xref (for performance) From: Dmitry Gutov To: 50777-done@debbugs.gnu.org References: <6b5b14d5-b2ca-8add-f4bf-a3405270c07a@yandex.ru> Message-ID: <0f00ae9c-2b0d-61c5-7f6c-5969632c93f5@yandex.ru> Date: Fri, 1 Oct 2021 00:10:07 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <6b5b14d5-b2ca-8add-f4bf-a3405270c07a@yandex.ru> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 1.9 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: In the absence of strong objections, pushed to Emacs 28. Sorry about jumping into a departing train: I had a flight this morning and had very little time the night before. In addition to other considerations, removing the unjustified restriction of ':type xref-location' on xref-match-item's location should also have a good effect on the ecosystem. Content analysis details: (1.9 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (raaahh[at]gmail.com) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.167.43 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.167.43 listed in list.dnswl.org] 1.5 RCVD_IN_SORBS_WEB RBL: SORBS: sender is an abusable web server [178.252.127.239 listed in dnsbl.sorbs.net] 0.2 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different -0.1 NICE_REPLY_A Looks like a legit reply (A) X-Debbugs-Envelope-To: 50777-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.9 (/) In the absence of strong objections, pushed to Emacs 28. Sorry about jumping into a departing train: I had a flight this morning and had very little time the night before. In addition to other considerations, removing the unjustified restriction of ':type xref-location' on xref-match-item's location should also have a good effect on the ecosystem. Thanks all. From unknown Sat Sep 20 08:01:34 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 29 Oct 2021 11:24:07 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator