From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 23 12:43:45 2020 Received: (at submit) by debbugs.gnu.org; 23 Aug 2020 16:43:45 +0000 Received: from localhost ([127.0.0.1]:55008 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k9t5t-0007KR-7M for submit@debbugs.gnu.org; Sun, 23 Aug 2020 12:43:45 -0400 Received: from lists.gnu.org ([209.51.188.17]:41890) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k9t5s-0007KG-0X for submit@debbugs.gnu.org; Sun, 23 Aug 2020 12:43:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39508) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k9t5r-0003Zn-Pb for bug-gnu-emacs@gnu.org; Sun, 23 Aug 2020 12:43:43 -0400 Received: from mout-p-201.mailbox.org ([2001:67c:2050::465:201]:29770) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1k9t5p-0004IV-1q for bug-gnu-emacs@gnu.org; Sun, 23 Aug 2020 12:43:43 -0400 Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:105:465:1:1:0]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4BZLft5P84zQlLD for ; Sun, 23 Aug 2020 18:43:34 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter01.heinlein-hosting.de (spamfilter01.heinlein-hosting.de [80.241.56.115]) (amavisd-new, port 10030) with ESMTP id WDVKfDYGgvG4 for ; Sun, 23 Aug 2020 18:43:31 +0200 (CEST) Date: Sun, 23 Aug 2020 18:43:30 +0200 From: Vasilij Schneidermann To: bug-gnu-emacs@gnu.org Subject: 27.1; gnutls-symmetric-encrypt slow when providing cipher as symbol Message-ID: <20200823164330.GA72308@odonien.localdomain> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="a8Wt8u1KmwUX3Y2C" Content-Disposition: inline X-MBO-SPAM-Probability: X-Rspamd-Score: -6.58 / 15.00 / 15.00 X-Rspamd-Queue-Id: B0F265FE X-Rspamd-UID: 5de47e Received-SPF: pass client-ip=2001:67c:2050::465:201; envelope-from=mail@vasilij.de; helo=mout-p-201.mailbox.org X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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, 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-Spam-Score: -1.7 (-) 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: -2.7 (--) --a8Wt8u1KmwUX3Y2C Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable I've recently debugged bad performance for a piece of code showing abysmal performance in its encryption loop. Compare the following benchmark results: (benchmark 10000 '(gnutls-symmetric-encrypt 'AES-128-CBC (make-string 16 0) (make-string 16 0) (make-string 16 0))) ;; =3D> "Elapsed time: 1.808647s (1.708427s in 124 GCs)" (benchmark 10000 '(gnutls-symmetric-encrypt 4 (make-string 16 0) (make-string 16 0) (make-string 16 0))) ;; =3D> "Elapsed time: 0.103690s (0.089148s in 6 GCs)" This seems to be the fault of how the cipher value is mapped to the cipher, if it's a symbol, the C code performs the equivalent of `(assoc cipher (gnutls-ciphers))`. Generating the cipher list over and over again seems like a waste of processing power. I'd consider either to document this behavior or making the mapping more efficient, for example by caching the cipher list instead of recomputing it over and over again. The latter would match the behavior as seen in other cryptographic library wrappers, for example the OpenSSL one in Ruby. In GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.22) of 2020-08-13 built on juergen Windowing system distributor 'The X.Org Foundation', version 11.0.12008000 System Description: Arch Linux Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Configured using: 'configure --prefix=3D/usr --sysconfdir=3D/etc --libexecdir=3D/usr/lib --localstatedir=3D/var --with-x-toolkit=3Dgtk3 --with-xft --with-wide-int --with-modules 'CFLAGS=3D-march=3Dx86-64 -mtune=3Dgeneric -O2 -pipe -fno-p= lt' CPPFLAGS=3D-D_FORTIFY_SOURCE=3D2 LDFLAGS=3D-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now' Configured features: XPM JPEG TIFF GIF PNG RSVG SOUND GPM DBUS GSETTINGS GLIB NOTIFY INOTIFY ACL GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS LIBSYSTEMD JSON PDUMPER LCMS2 GMP Important settings: value of $LC_MESSAGES:=20 value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t eldoc-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 auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg epg-config gnus-util rmail rmail-loaddefs text-property-search time-date subr-x seq byte-opt gv bytecomp byte-compile cconv mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type 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 elisp-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core term/tty-colors frame minibuffer cl-generic 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 charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote threads dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 45005 6273) (symbols 48 6004 1) (strings 32 15483 2032) (string-bytes 1 504714) (vectors 16 10090) (vector-slots 8 130067 10258) (floats 8 19 27) (intervals 56 196 0) (buffers 1000 11)) --a8Wt8u1KmwUX3Y2C Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEE0dAcySl3bqM8O17WFmfJg6zCifoFAl9CnKoACgkQFmfJg6zC ifpdWgf+Kjn7SHyzOey3lfixhPXEUr4ZBPBkeoX3YRO+dFPa9h9DhUdAvtCG2Tye aDLmOhdzkRtvzKGHzhvpU6YDz6tJcbR7jTAMeb8DzY2FH8AwbEcKvLrhq+jGOhKz JxROmgpK/7GWACfDabNuOrmvB7xlaiRyOQ7H7X/W0GoyWUZLrg/vbWPtvhipnRwV 3/S3xyqvVjqwKZcT0zYCLACivXj3qdN5JG1PisMtqKRyT6NdO6dMaN3yRmtKi6DZ /7CNd3JXgJafQhh7AVl9//R3XelTPHengAO8jTrX2Fr4Rgo2lr1Y8nXgM/+TkQjs QlfglAsZwZUoVIZhCUXlAlqOv7tnqg== =SxM9 -----END PGP SIGNATURE----- --a8Wt8u1KmwUX3Y2C-- From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 24 09:01:15 2020 Received: (at 42998) by debbugs.gnu.org; 24 Aug 2020 13:01:15 +0000 Received: from localhost ([127.0.0.1]:56492 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kAC67-0006pr-H7 for submit@debbugs.gnu.org; Mon, 24 Aug 2020 09:01:15 -0400 Received: from quimby.gnus.org ([95.216.78.240]:56786) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kAC64-0006pb-F1 for 42998@debbugs.gnu.org; Mon, 24 Aug 2020 09:01:15 -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=hvDfxhr5rQfxhD4NqIxW/Og/wEE/bFnRqlTfkKbZE7M=; b=BCiIKUx4dxdiSjjWbK+Z2yWZQE UnBiaWw0PFkUy06r+ywvNeONHARtJ2cCTrpt/+TdticiO1HBBrnm4fFiakwL/iUFo2hWC6DOceWog IFssbcD2XIkh+8Ht2xy3TghupXAjwnol5FwK5pjHUgIER2rYqKbV8mpoTokQdrtexTVc=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kAC5u-0006Jb-SA; Mon, 24 Aug 2020 15:01:05 +0200 From: Lars Ingebrigtsen To: Vasilij Schneidermann Subject: Re: bug#42998: 27.1; gnutls-symmetric-encrypt slow when providing cipher as symbol References: <20200823164330.GA72308@odonien.localdomain> X-Now-Playing: Kokoko!'s _Fongola_: "Kitoko" Date: Mon, 24 Aug 2020 15:01:01 +0200 In-Reply-To: <20200823164330.GA72308@odonien.localdomain> (Vasilij Schneidermann's message of "Sun, 23 Aug 2020 18:43:30 +0200") Message-ID: <87y2m4ci5u.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: Vasilij Schneidermann writes: > I'd consider either to > document this behavior or making the mapping more efficient, for example > by caching the cipher list instead of recomputing it over and over > again. 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: 0.0 (/) X-Debbugs-Envelope-To: 42998 Cc: 42998@debbugs.gnu.org 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 (-) Vasilij Schneidermann writes: > I'd consider either to > document this behavior or making the mapping more efficient, for example > by caching the cipher list instead of recomputing it over and over > again. The following fixes the problem, but I'm not quite sure whether it's correct... Is initialising a Lisp_Object to NULL something that's allowed over all platforms? I can't initialise it to the more natural Qnil, since that's not a constant, C-wise. diff --git a/src/gnutls.c b/src/gnutls.c index 416fb15470..75bc7d970f 100644 --- a/src/gnutls.c +++ b/src/gnutls.c @@ -2303,6 +2303,8 @@ gnutls_symmetric (bool encrypting, Lisp_Object cipher, Lisp_Object key, Lisp_Object iv, Lisp_Object input, Lisp_Object aead_auth) { + static Lisp_Object cipher_cache = NULL; + if (BUFFERP (key) || STRINGP (key)) key = list1 (key); @@ -2329,7 +2331,12 @@ gnutls_symmetric (bool encrypting, Lisp_Object cipher, if (SYMBOLP (cipher)) { - info = Fassq (cipher, Fgnutls_ciphers ()); + if (! cipher_cache) + { + cipher_cache = Fgnutls_ciphers (); + staticpro (&cipher_cache); + } + info = Fassq (cipher, cipher_cache); if (!CONSP (info)) xsignal2 (Qerror, build_string ("GnuTLS cipher is invalid or not found"), -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 24 09:32:04 2020 Received: (at 42998) by debbugs.gnu.org; 24 Aug 2020 13:32:04 +0000 Received: from localhost ([127.0.0.1]:56579 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kACZw-00039a-Jb for submit@debbugs.gnu.org; Mon, 24 Aug 2020 09:32:04 -0400 Received: from eggs.gnu.org ([209.51.188.92]:44494) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kACZu-00033a-FS for 42998@debbugs.gnu.org; Mon, 24 Aug 2020 09:32:03 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:44532) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kACZn-0003Iw-S3; Mon, 24 Aug 2020 09:31:55 -0400 Received: from [176.228.60.248] (port=1284 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kACZm-0006RD-V1; Mon, 24 Aug 2020 09:31:55 -0400 Date: Mon, 24 Aug 2020 16:31:44 +0300 Message-Id: <835z986ugv.fsf@gnu.org> From: Eli Zaretskii To: Lars Ingebrigtsen In-Reply-To: <87y2m4ci5u.fsf@gnus.org> (message from Lars Ingebrigtsen on Mon, 24 Aug 2020 15:01:01 +0200) Subject: Re: bug#42998: 27.1; gnutls-symmetric-encrypt slow when providing cipher as symbol References: <20200823164330.GA72308@odonien.localdomain> <87y2m4ci5u.fsf@gnus.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 42998 Cc: 42998@debbugs.gnu.org, mail@vasilij.de 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 (---) > From: Lars Ingebrigtsen > Date: Mon, 24 Aug 2020 15:01:01 +0200 > Cc: 42998@debbugs.gnu.org > > Vasilij Schneidermann writes: > > > I'd consider either to > > document this behavior or making the mapping more efficient, for example > > by caching the cipher list instead of recomputing it over and over > > again. > > The following fixes the problem, but I'm not quite sure whether it's > correct... Is initialising a Lisp_Object to NULL something that's > allowed over all platforms? Since Lisp_Object is not really a pointer, at least not in all builds, this might work, but is fragile, and thus not recommended. > I can't initialise it to the more natural Qnil, since that's not a > constant, C-wise. Such initializations shall be done in the syms_of_* functions, in this case syms_of_gnutls -- those run at build time, and are recorded in the dumped memory. yes, that means the static variable will not be private to the function, but I don't think it's a problem. I think it'd also allow you to staticpro the variable only once. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 24 10:22:46 2020 Received: (at 42998) by debbugs.gnu.org; 24 Aug 2020 14:22:46 +0000 Received: from localhost ([127.0.0.1]:58761 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kADN0-0001Q2-69 for submit@debbugs.gnu.org; Mon, 24 Aug 2020 10:22:46 -0400 Received: from quimby.gnus.org ([95.216.78.240]:58296) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kADMy-0001Pp-AP for 42998@debbugs.gnu.org; Mon, 24 Aug 2020 10:22:44 -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=AEYOAjfgY/fb9Wc3k5sZraInp5jM+r//6/ICoXxhBqo=; b=rgxAIo3hLu/w8lpX1n8Ws7rDBc QxEwyNHeQgBJSKt4S+1IxP7K+M5tr6cMRd1o7fcYxM8tdt53n7ZB7snt1AwNJ2bCzxxjNtpAEMcvP SbygxZYNFXVUQGW1DAjozqqMaKRrxjOpLxjFz1F0prte0Es5qbyG2E8gYA8P1A8G1tHw=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kADMo-0007MQ-Qw; Mon, 24 Aug 2020 16:22:37 +0200 From: Lars Ingebrigtsen To: Eli Zaretskii Subject: Re: bug#42998: 27.1; gnutls-symmetric-encrypt slow when providing cipher as symbol References: <20200823164330.GA72308@odonien.localdomain> <87y2m4ci5u.fsf@gnus.org> <835z986ugv.fsf@gnu.org> X-Now-Playing: Sevdaliza's _ISON_: "Shahmaran" Date: Mon, 24 Aug 2020 16:22:33 +0200 In-Reply-To: <835z986ugv.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 24 Aug 2020 16:31:44 +0300") Message-ID: <87sgcc9l92.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: Eli Zaretskii writes: > Such initializations shall be done in the syms_of_* functions, in this > case syms_of_gnutls -- those run at build time, and are recorded in > the dumped memory. yes, that means the static variable [...] 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: 0.0 (/) X-Debbugs-Envelope-To: 42998 Cc: mail@vasilij.de, 42998@debbugs.gnu.org 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 (-) Eli Zaretskii writes: > Such initializations shall be done in the syms_of_* functions, in this > case syms_of_gnutls -- those run at build time, and are recorded in > the dumped memory. yes, that means the static variable will not be > private to the function, but I don't think it's a problem. OK, I'll do that instead. > I think it'd also allow you to staticpro the variable only once. Don't we need to staticpro the variable only once in any case, or am I misunderstanding how staticpro works? I assumed that it took the address of the variable, and then it'll protect whatever that variable points to, no matter whether we change the value or not? -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 24 10:28:34 2020 Received: (at 42998) by debbugs.gnu.org; 24 Aug 2020 14:28:34 +0000 Received: from localhost ([127.0.0.1]:58776 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kADSc-0001Yi-BQ for submit@debbugs.gnu.org; Mon, 24 Aug 2020 10:28:34 -0400 Received: from quimby.gnus.org ([95.216.78.240]:58324) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kADSa-0001YV-L6 for 42998@debbugs.gnu.org; Mon, 24 Aug 2020 10:28:33 -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=7Dk15lGpMK/Eou0qZkRxwoLFMcqNawt4G+XMFZjxfFw=; b=PHFnECrTh1gyctpj5Jk/EY0IU8 eS2Y5vOGFFtz4pUv3mUUw7H13X49zHMx4EmXoQQWCTD4VeLz866aFPiTpBs75ltS32lbb4ifhdtP8 3THIrT6FJ9RzOu5jFkCD6xMpX21MKNoN2Xrxu7DaEXS+9Zn9Z8ZHAGuu3xrKWeYBxqj0=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kADSR-0007R2-D1; Mon, 24 Aug 2020 16:28:26 +0200 From: Lars Ingebrigtsen To: Eli Zaretskii Subject: Re: bug#42998: 27.1; gnutls-symmetric-encrypt slow when providing cipher as symbol References: <20200823164330.GA72308@odonien.localdomain> <87y2m4ci5u.fsf@gnus.org> <835z986ugv.fsf@gnu.org> Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAIVBMVEXKEBrSESPYKC6Z EBVSCxEfBwttCxJoKimMSkh8Q0D////HQmIzAAAAAWJLR0QKaND0VgAAAAd0SU1FB+QIGA4aHT1p fI0AAAGoSURBVDjLdZNNTuQwEIUTBbGGuQFzgkYevG6JcnyAuGALStpodiyC3KxnpE7fIMedqvJP wqR5y/flxVXPSVX/zPpxd3e7qMqqb7/oplrpC6u+ixS7Ump3CTRg0N1fAAZJbrcB9QEdsW4LHtB+ oHu5AJ5PAY9/6s0ZV8/zMUzj63YPO0/TOTxuwXma5umvfd3sEebpPI2w/x8ofZzP8yWgfp9CGO37 FryFED5PoV65jVKN9wOCDca+LH2Tr67bASy60YZ9tnfsMzABnQ1jt7ycpR1Iv4BdtAqQclldcgqA DJoV6L03mIFagKZZC3hSugDvOZH0pL28u4r+Cqg+JbSAwwKUoIpdAD+4hFx80BMYAKDlrmLCZ8A+ RbxPiQIAEonnQwYDZNEhDrH1IKdWxW8hJpIWAHQIvc1tQKsRf3VmDWK8v3YG3KGAPBXsmv7B0E9C O0WQ9EiArkuATCUul0NA8S4yIAEpV+rkkgaZigIt30evpekCWtlcyieg+4FLNm6IzclFSYA+OR4I U6VpKr5gwwa46OdxOePTs6ldAPkA45KytjGyIH6jf75JBbLZywoVAAAAJXRFWHRkYXRlOmNyZWF0 ZQAyMDIwLTA4LTI0VDE0OjI2OjI5KzAwOjAw2kmn/wAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMC0w OC0yNFQxNDoyNjoyOSswMDowMKsUH0MAAAAASUVORK5CYII= X-Now-Playing: Sevdaliza's _ISON_: "Marilyn Monroe" Date: Mon, 24 Aug 2020 16:28:21 +0200 In-Reply-To: <835z986ugv.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 24 Aug 2020 16:31:44 +0300") Message-ID: <87o8n09kze.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: OK, I've redone this as a file-local variable, but I'm not totally sure that I'm putting this inside the correct #ifdefs. :-/ gnutls.c is a mess if #ifdefs -- does Emacs have a command that lists all the #ifdefs that are in effect at the current point? 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: 0.0 (/) X-Debbugs-Envelope-To: 42998 Cc: 42998@debbugs.gnu.org, mail@vasilij.de 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 (-) OK, I've redone this as a file-local variable, but I'm not totally sure that I'm putting this inside the correct #ifdefs. :-/ gnutls.c is a mess if #ifdefs -- does Emacs have a command that lists all the #ifdefs that are in effect at the current point? diff --git a/src/gnutls.c b/src/gnutls.c index 416fb15470..0010553a9d 100644 --- a/src/gnutls.c +++ b/src/gnutls.c @@ -2298,6 +2298,8 @@ gnutls_symmetric_aead (bool encrypting, gnutls_cipher_algorithm_t gca, # endif } +static Lisp_Object cipher_cache; + static Lisp_Object gnutls_symmetric (bool encrypting, Lisp_Object cipher, Lisp_Object key, Lisp_Object iv, @@ -2329,7 +2331,9 @@ gnutls_symmetric (bool encrypting, Lisp_Object cipher, if (SYMBOLP (cipher)) { - info = Fassq (cipher, Fgnutls_ciphers ()); + if (NILP (cipher_cache)) + cipher_cache = Fgnutls_ciphers (); + info = Fassq (cipher, cipher_cache); if (!CONSP (info)) xsignal2 (Qerror, build_string ("GnuTLS cipher is invalid or not found"), @@ -2914,6 +2918,9 @@ syms_of_gnutls (void) defsubr (&Sgnutls_hash_digest); defsubr (&Sgnutls_symmetric_encrypt); defsubr (&Sgnutls_symmetric_decrypt); + + cipher_cache = Qnil; + staticpro (&cipher_cache); #endif DEFVAR_INT ("gnutls-log-level", global_gnutls_log_level, -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 24 10:34:13 2020 Received: (at 42998) by debbugs.gnu.org; 24 Aug 2020 14:34:13 +0000 Received: from localhost ([127.0.0.1]:58786 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kADY0-0001i8-CN for submit@debbugs.gnu.org; Mon, 24 Aug 2020 10:34:13 -0400 Received: from eggs.gnu.org ([209.51.188.92]:34952) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kADXx-0001hd-77 for 42998@debbugs.gnu.org; Mon, 24 Aug 2020 10:34:07 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:46038) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kADXo-0003Y3-W7; Mon, 24 Aug 2020 10:33:57 -0400 Received: from [176.228.60.248] (port=1118 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kADXm-0004qY-Vn; Mon, 24 Aug 2020 10:33:56 -0400 Date: Mon, 24 Aug 2020 17:33:43 +0300 Message-Id: <831rjw6rlk.fsf@gnu.org> From: Eli Zaretskii To: Lars Ingebrigtsen In-Reply-To: <87sgcc9l92.fsf@gnus.org> (message from Lars Ingebrigtsen on Mon, 24 Aug 2020 16:22:33 +0200) Subject: Re: bug#42998: 27.1; gnutls-symmetric-encrypt slow when providing cipher as symbol References: <20200823164330.GA72308@odonien.localdomain> <87y2m4ci5u.fsf@gnus.org> <835z986ugv.fsf@gnu.org> <87sgcc9l92.fsf@gnus.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 42998 Cc: mail@vasilij.de, 42998@debbugs.gnu.org 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 (-) > From: Lars Ingebrigtsen > Cc: 42998@debbugs.gnu.org, mail@vasilij.de > Date: Mon, 24 Aug 2020 16:22:33 +0200 > > > I think it'd also allow you to staticpro the variable only once. > > Don't we need to staticpro the variable only once in any case, or am I > misunderstanding how staticpro works? Yes. I meant that one time should be in syms_of_gnutls. From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 24 10:36:54 2020 Received: (at 42998) by debbugs.gnu.org; 24 Aug 2020 14:36:54 +0000 Received: from localhost ([127.0.0.1]:58790 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kADaf-0001lw-N5 for submit@debbugs.gnu.org; Mon, 24 Aug 2020 10:36:53 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35754) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kADad-0001lj-Fy for 42998@debbugs.gnu.org; Mon, 24 Aug 2020 10:36:52 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:46096) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kADaY-00040W-4v; Mon, 24 Aug 2020 10:36:46 -0400 Received: from [176.228.60.248] (port=1290 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kADaX-0007Rj-Lr; Mon, 24 Aug 2020 10:36:45 -0400 Date: Mon, 24 Aug 2020 17:36:34 +0300 Message-Id: <83zh6k5cwd.fsf@gnu.org> From: Eli Zaretskii To: Lars Ingebrigtsen In-Reply-To: <87o8n09kze.fsf@gnus.org> (message from Lars Ingebrigtsen on Mon, 24 Aug 2020 16:28:21 +0200) Subject: Re: bug#42998: 27.1; gnutls-symmetric-encrypt slow when providing cipher as symbol References: <20200823164330.GA72308@odonien.localdomain> <87y2m4ci5u.fsf@gnus.org> <835z986ugv.fsf@gnu.org> <87o8n09kze.fsf@gnus.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 42998 Cc: 42998@debbugs.gnu.org, mail@vasilij.de 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 (---) > From: Lars Ingebrigtsen > Cc: mail@vasilij.de, 42998@debbugs.gnu.org > Date: Mon, 24 Aug 2020 16:28:21 +0200 > > gnutls.c is a mess if #ifdefs -- does Emacs have a command that lists > all the #ifdefs that are in effect at the current point? I suggest "C-u 1 C-x $". From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 24 10:45:42 2020 Received: (at 42998) by debbugs.gnu.org; 24 Aug 2020 14:45:43 +0000 Received: from localhost ([127.0.0.1]:58835 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kADjC-00020h-K6 for submit@debbugs.gnu.org; Mon, 24 Aug 2020 10:45:42 -0400 Received: from quimby.gnus.org ([95.216.78.240]:58540) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kADjA-00020Q-Po for 42998@debbugs.gnu.org; Mon, 24 Aug 2020 10:45:41 -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=odN/jcHUE+wJOhU09vjYlvSRvnAzUdfB78ubTv95k9g=; b=ELCpqvVq/pFl7NAHe9cE7hAAve YaBMZ2pKhgNVU5Cl1BrFeUZLs3yRnJOqAPxRbJj9TOxt7C8SKhjoTmlq/Lin8oIcpRRTc+M5+so8h lQkQ55YOiDS2coASEKuu318etvBWdRYYLNK7CORVda3mvxUcxpjUVGDYsL9tm3ZCF2ro=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kADiz-0007dP-Ok; Mon, 24 Aug 2020 16:45:34 +0200 From: Lars Ingebrigtsen To: Eli Zaretskii Subject: Re: bug#42998: 27.1; gnutls-symmetric-encrypt slow when providing cipher as symbol References: <20200823164330.GA72308@odonien.localdomain> <87y2m4ci5u.fsf@gnus.org> <835z986ugv.fsf@gnu.org> <87o8n09kze.fsf@gnus.org> <83zh6k5cwd.fsf@gnu.org> X-Now-Playing: Sevdaliza's _ISON_: "Bluecid" Date: Mon, 24 Aug 2020 16:45:28 +0200 In-Reply-To: <83zh6k5cwd.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 24 Aug 2020 17:36:34 +0300") Message-ID: <87blj09k6v.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: Eli Zaretskii writes: >> gnutls.c is a mess if #ifdefs -- does Emacs have a command that lists >> all the #ifdefs that are in effect at the current point? > > I suggest "C-u 1 C-x $". Thanks, but that didn't really help that much in gnutls.c, apparently. But I worked my way up in the ifdef/endif mess and I think I put the init in the right section. 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: 0.0 (/) X-Debbugs-Envelope-To: 42998 Cc: mail@vasilij.de, 42998@debbugs.gnu.org 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 (-) Eli Zaretskii writes: >> gnutls.c is a mess if #ifdefs -- does Emacs have a command that lists >> all the #ifdefs that are in effect at the current point? > > I suggest "C-u 1 C-x $". Thanks, but that didn't really help that much in gnutls.c, apparently. But I worked my way up in the ifdef/endif mess and I think I put the init in the right section. Pushed to Emacs 28. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 24 10:45:49 2020 Received: (at control) by debbugs.gnu.org; 24 Aug 2020 14:45:49 +0000 Received: from localhost ([127.0.0.1]:58838 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kADjI-000210-Tv for submit@debbugs.gnu.org; Mon, 24 Aug 2020 10:45:49 -0400 Received: from quimby.gnus.org ([95.216.78.240]:58554) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kADjH-00020f-7j for control@debbugs.gnu.org; Mon, 24 Aug 2020 10:45:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=SpD6pdjS5Zip9fd1PTLRuGMZZ03LuF9+qAKtNNbV210=; b=Vc2OunZv/HjVIpc8jorD6vpeX5 1xLUvWU7RlgGIJQBETRl1eMU4mU5GSeC81aIjsgKSXHYYBqStj1zVfoCdbuuyGYDsmeR6bVyErzC9 zWaej/VvfABdRGnRZWnfwCH+m5KYAH/Mkd2YHwEnZmnlFnOhxHOCfl4a5rwqlMk4kXWw=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kADj9-0007da-Fu for control@debbugs.gnu.org; Mon, 24 Aug 2020 16:45:41 +0200 Date: Mon, 24 Aug 2020 16:45:38 +0200 Message-Id: <87a6yk9k6l.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #42998 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: tags 42998 fixed close 42998 28.1 quit 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: 0.0 (/) X-Debbugs-Envelope-To: control 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 (-) tags 42998 fixed close 42998 28.1 quit From unknown Thu Jul 31 17:38: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: Tue, 22 Sep 2020 11:24:12 +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