X-Loop: help-debbugs@HIDDEN
Subject: bug#79774: [PATCH] [NS] Image type cache
Resent-From: =?UTF-8?Q?Przemys=C5=82aw?= Alexander =?UTF-8?Q?Kami=C5=84ski?= <alexander@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Wed, 05 Nov 2025 18:47:01 +0000
Resent-Message-ID: <handler.79774.B.176236838610860 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 79774
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: 79774 <at> debbugs.gnu.org
X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.176236838610860
(code B ref -1); Wed, 05 Nov 2025 18:47:01 +0000
Received: (at submit) by debbugs.gnu.org; 5 Nov 2025 18:46:26 +0000
Received: from localhost ([127.0.0.1]:58628 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1vGiWX-0002p6-Iq
for submit <at> debbugs.gnu.org; Wed, 05 Nov 2025 13:46:26 -0500
Received: from lists.gnu.org ([2001:470:142::17]:37742)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <alexander@HIDDEN>)
id 1vGiWU-0002on-Eg
for submit <at> debbugs.gnu.org; Wed, 05 Nov 2025 13:46:23 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.90_1) (envelope-from <alexander@HIDDEN>)
id 1vGiWO-0003C6-JX
for bug-gnu-emacs@HIDDEN; Wed, 05 Nov 2025 13:46:16 -0500
Received: from fout-a6-smtp.messagingengine.com ([103.168.172.149])
by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.90_1) (envelope-from <alexander@HIDDEN>)
id 1vGiWK-0001Y2-EL
for bug-gnu-emacs@HIDDEN; Wed, 05 Nov 2025 13:46:16 -0500
Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44])
by mailfout.phl.internal (Postfix) with ESMTP id 08C70EC0231
for <bug-gnu-emacs@HIDDEN>; Wed, 5 Nov 2025 13:46:11 -0500 (EST)
Received: from phl-mailfrontend-01 ([10.202.2.162])
by phl-compute-04.internal (MEProxy); Wed, 05 Nov 2025 13:46:11 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kaminski.se; h=
cc:content-type:content-type:date:date:from:from:in-reply-to
:message-id:mime-version:reply-to:subject:subject:to:to; s=fm1;
t=1762368371; x=1762454771; bh=byuWDcXzsDa+eUz8fstrytzYZg7fIF/U
slPk0R9e7qA=; b=J7HFCfgRoYw3kMt9/fhTeh0Msw8rjhvvhy24D+P9hsDmhBJY
/OWGJ2Kn/7GYYCypcfqdrDwva3BRWJj7b2HRDj7O+p4EhQYVNHOcE/olLl5W5ZSO
xekkbIldUbxrGiLhdFehSZARWss/XlVplYkEP6a7BcW5zLwW3w42syAGoU5hPtMv
zYu2zguWT2JcLJulx1bcxemm1/FTWJam7ewV+cKbDVkxYV9tshQJzfKtKShGgS9J
v9AhK3FJMSA5kspH+h9JhSX3tqMpvFeEexrVabz7ahBM0VR+dc5tNFFkD4k5Rtkm
CaTPlrZ8jgSt9JNtbG0YGzo38XM/pNycMcF6cA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
messagingengine.com; h=cc:content-type:content-type:date:date
:feedback-id:feedback-id:from:from:in-reply-to:message-id
:mime-version:reply-to:subject:subject:to:to:x-me-proxy
:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1762368371; x=
1762454771; bh=byuWDcXzsDa+eUz8fstrytzYZg7fIF/UslPk0R9e7qA=; b=p
YP/2Y1I/nWaWDXdVednxxvzSJ0Tz2VG/8OtfnpmPih+akEFZKrkQvYgo14LhK9wf
x9YkyOEmdwuM8WUdQLK1Ery6Yr8hMhZbzyE8L5MfkDOe0wmftb1Nfj+W7MiMfTRf
5h8pS8tNGPcGvTX/MhUPdaMzbQXFCCdj13lkjLLTX2T/9BhF3dzQTE6QB+Rj14i/
SBrM148/972TSPisVRYO9qHDurrKBVZDZoSZx+ByU1juioqPibl0PjZ/YHNGekFc
xSY0tKknyOnnV5NDZp7npMh2/oV06MG+00E4o0vChtVaUerQjwJjAyiSO8KNAn8/
6E+VuUw59F+yjrNU9LCAQ==
X-ME-Sender: <xms:cpsLaUBk4HXiDYx2sG4d6L-cURFkDu2lNuiAIMv2f-HSi9A-q0TV6Q>
<xme:cpsLacbAOSiW4pBhLoWmehsc1PUNeLhpynFHygHEfgqjUMQqflkzF_1brAaOiPsGx
SnM-3xcDojycwpUR0cCYKIEQAd02aRMmLVwTAeMdZ9I9MdrlMXh>
X-ME-Received: <xmr:cpsLaSrFAXem3JG8S1r0x2_IhMrfrfKbiVGzcjJRurV7hQ_ZrM2mLbiKNKYsDU2utkDdtkTFWZDFojJnlBX9_J7bbLNG>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggddukeegieeiucetufdoteggodetrf
dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu
rghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkgggtsehmtderredttdejne
cuhfhrohhmpefrrhiivghmhihslhgrficutehlvgigrghnuggvrhcumfgrmhhiknhskhhi
uceorghlvgigrghnuggvrheskhgrmhhinhhskhhirdhsvgeqnecuggftrfgrthhtvghrnh
epvdefheehveekjefgvdfhfeetvedvueevueeuleffueeiieeugeehhedvuddukedtnecu
ffhomhgrihhnpeiglhhiihdrshhprggtvgdptghouggvsggvrhhgrdhorhhgnecuvehluh
hsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghlvgigrghnuggv
rheskhgrmhhinhhskhhirdhsvgdpnhgspghrtghpthhtohepuddpmhhouggvpehsmhhtph
houhhtpdhrtghpthhtohepsghughdqghhnuhdqvghmrggtshesghhnuhdrohhrgh
X-ME-Proxy: <xmx:cpsLaXnDPBhC0_2LWspS3rnkEjg02kI0mFTW1bd-nQHJTHG4Bew4_Q>
<xmx:cpsLac1bLIcUoX1dEpFIV1YTqF1AjsPr3m8XDv-_Iv_Pz56NHwPEkA>
<xmx:cpsLaXDFzjeZO5e30pzk_mWXN5kLAaRvqw_hKui1Bt96cOey_9uZ7Q>
<xmx:cpsLaRym0UzLXhzF0ywqM3D3jbH4562AbpZLeTXD_1zO29-IItazhw>
<xmx:cpsLaaR-j-rL9fz3LTvxVBMUU4hupGRyqryjbX5oHj3rHC3wG79Qkkzn>
Feedback-ID: i282146b2:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA for
<bug-gnu-emacs@HIDDEN>; Wed, 5 Nov 2025 13:46:10 -0500 (EST)
From: =?UTF-8?Q?Przemys=C5=82aw?= Alexander =?UTF-8?Q?Kami=C5=84ski?=
<alexander@HIDDEN>
Date: Wed, 05 Nov 2025 19:46:08 +0100
Message-ID: <m2frasiahb.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Received-SPF: pass client-ip=103.168.172.149;
envelope-from=alexander@HIDDEN; helo=fout-a6-smtp.messagingengine.com
X-Spam_score_int: -27
X-Spam_score: -2.8
X-Spam_bar: --
X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001,
RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001,
SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.7 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.3 (/)
--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
This patch makes image type dictionary cache which prevents doing
NSString allocations on every image type checks (around 40-60KiB per
type check).
This patch is stable, I've been using it for >2 months without any issues.
--=20
Przemys=C5=82aw Alexander Kami=C5=84ski (vel xlii vel exlee)
https://xlii.space || https://codeberg.org/exlee
--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment; filename=ns_native_api_dict_0003.patch
diff --git a/src/nsimage.m b/src/nsimage.m
index 8f1653d085..93ee191087 100644
--- a/src/nsimage.m
+++ b/src/nsimage.m
@@ -56,9 +56,66 @@
========================================================================== */
+static CFDictionaryRef image_api_dict;
+
+/*
+ ns_image_init initializes native support image type cache-dict for
+ ns_can_use_native_image_api. Needs to be initialized ad-hoc since it's
+ possible that non-GUI subprocesses will use it.
+
+ Without the cache-dict hundreds of thousands of small, persistent
+ NSString allocations are happening causing 40-60KiB leak per usage. */
+
+
+static void ns_image_init (void)
+{
+ /* NSImage also supports a host of other types such as PDF and BMP,
+ but we don't yet support these in image.c. */
+ NSArray *imageTypes = [NSImage imageTypes];
+ Lisp_Object keys[] =
+ {
+ Qnative_image, Qjpeg, Qpng, Qgif, Qtiff,
+#ifndef HAVE_RSVG
+ Qsvg,
+#endif
+#ifndef HAVE_WEBP
+ Qwebp,
+#endif
+ Qheic
+ };
+ bool values[] = {
+ YES,
+ [imageTypes containsObject:@"public.jpeg"],
+ [imageTypes containsObject:@"public.png"],
+ [imageTypes containsObject:@"com.compuserve.gif"],
+ [imageTypes containsObject:@"public.tiff"],
+#ifndef HAVE_RSVG
+ [imageTypes containsObject:@"public.svg-image"],
+#endif
+#ifndef HAVE_WEBP
+ [imageTypes containsObject:@"org.webmproject.webp"],
+#endif
+ [imageTypes containsObject:@"public.heic"],
+ };
+ image_api_dict
+ = CFDictionaryCreate (NULL, (void *) keys, (void *) values, 50,
+ NULL, NULL);
+ CFRetain (image_api_dict);
+}
+
bool
ns_can_use_native_image_api (Lisp_Object type)
{
+#ifdef NS_IMPL_COCOA
+ if (!image_api_dict)
+ ns_image_init ();
+
+ bool found;
+ CFDictionaryGetValueIfPresent(image_api_dict, type,
+ (void *) &found);
+ return found;
+
+#endif
NSString *imageType = @"unknown";
NSArray *types;
@@ -67,32 +124,6 @@
if (EQ (type, Qnative_image))
return YES;
-#ifdef NS_IMPL_COCOA
- /* Work out the UTI of the image type. */
- if (EQ (type, Qjpeg))
- imageType = @"public.jpeg";
- else if (EQ (type, Qpng))
- imageType = @"public.png";
- else if (EQ (type, Qgif))
- imageType = @"com.compuserve.gif";
- else if (EQ (type, Qtiff))
- imageType = @"public.tiff";
-#ifndef HAVE_RSVG
- else if (EQ (type, Qsvg))
- imageType = @"public.svg-image";
-#endif
-#ifndef HAVE_WEBP
- else if (EQ (type, Qwebp))
- imageType = @"org.webmproject.webp";
-#endif
- else if (EQ (type, Qheic))
- imageType = @"public.heic";
-
- /* NSImage also supports a host of other types such as PDF and BMP,
- but we don't yet support these in image.c. */
-
- types = [NSImage imageTypes];
-#else
/* Work out the image type. */
if (EQ (type, Qjpeg))
imageType = @"jpeg";
@@ -104,7 +135,6 @@
imageType = @"tiff";
types = [NSImage imageFileTypes];
-#endif
/* Check if the type is supported on this system. */
if ([types indexOfObject:imageType] != NSNotFound)
--=-=-=--
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: =?UTF-8?Q?Przemys=C5=82aw?= Alexander =?UTF-8?Q?Kami=C5=84ski?= <alexander@HIDDEN> Subject: bug#79774: Acknowledgement ([PATCH] [NS] Image type cache) Message-ID: <handler.79774.B.176236838610860.ack <at> debbugs.gnu.org> References: <m2frasiahb.fsf@HIDDEN> X-Gnu-PR-Message: ack 79774 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 79774 <at> debbugs.gnu.org Date: Wed, 05 Nov 2025 18:47:02 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. Your message has been sent to the package maintainer(s): bug-gnu-emacs@HIDDEN If you wish to submit further information on this problem, please send it to 79774 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 79774: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D79774 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
X-Loop: help-debbugs@HIDDEN
Subject: bug#79774: [PATCH] [NS] Image type cache
Resent-From: =?UTF-8?Q?St=C3=A9phane?= Marks <shipmints@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Wed, 05 Nov 2025 18:53:02 +0000
Resent-Message-ID: <handler.79774.B79774.176236875411625 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 79774
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: =?UTF-8?Q?Przemys=C5=82aw?= Alexander =?UTF-8?Q?Kami=C5=84ski?= <alexander@HIDDEN>
Cc: 79774 <at> debbugs.gnu.org
Received: via spool by 79774-submit <at> debbugs.gnu.org id=B79774.176236875411625
(code B ref 79774); Wed, 05 Nov 2025 18:53:02 +0000
Received: (at 79774) by debbugs.gnu.org; 5 Nov 2025 18:52:34 +0000
Received: from localhost ([127.0.0.1]:58665 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1vGicT-00031R-Qp
for submit <at> debbugs.gnu.org; Wed, 05 Nov 2025 13:52:34 -0500
Received: from mail-vs1-xe35.google.com ([2607:f8b0:4864:20::e35]:47411)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.84_2) (envelope-from <shipmints@HIDDEN>)
id 1vGicR-00031D-DC
for 79774 <at> debbugs.gnu.org; Wed, 05 Nov 2025 13:52:32 -0500
Received: by mail-vs1-xe35.google.com with SMTP id
ada2fe7eead31-58de3ab1831so113010137.3
for <79774 <at> debbugs.gnu.org>; Wed, 05 Nov 2025 10:52:31 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1762368745; x=1762973545; darn=debbugs.gnu.org;
h=cc:to:subject:message-id:date:from:in-reply-to:references
:mime-version:from:to:cc:subject:date:message-id:reply-to;
bh=QQNqupzlXT936RVDMX/4fSpExRrh5gSdt+pLrG6kZ68=;
b=HX0oMqraEL0FDvP92BSYZ2Y2PL/eJZZJn90VoSc5iTJyVL3C20ph+za/b7ENQ/2zS9
FIiTblI5NGmOD5KILriImUPF6Zr8EFNsj84BOGo397KRZksqhacjTzvz6ASGyTG+bS0g
G6xY5UEqcJs5xaVjGxWopPMXkmEinsCwG3Pu7iLWJeHV5NAAU9DooHeqfAMqIm+/OGKi
wY9Nhv6uiVZ2kMRPw4vgMCTENSU/hVqAS213PlRPcPJ6T4XECfo/8nY5tcwZ078pEXRl
WpZY17Zzf9UUxQjZDOjhi0nxa8gfGGtdwLQcPkCeM18RHqnsY/PvjnTv/ldJWTaMUPnT
xD3Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1762368745; x=1762973545;
h=cc:to:subject:message-id:date:from:in-reply-to:references
:mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=QQNqupzlXT936RVDMX/4fSpExRrh5gSdt+pLrG6kZ68=;
b=uFU+wDLh0R2LLOK+85YDVtXLbolEGszZZ9q1lbbHU384T8JcHdlx9ZedVHjRqwgryu
/qaUSnZp8QqSYvEoeELtWuLHBZWqCPs7NFavTnjgWZJAmpzotRGDn1gUQObnNmVKjUb7
VxIJG1Dv3ohJpsaWNkLOX+7GhZs435ghC51lHjhs/6DHRBONFGcohc3bwIypSj1XmyvG
HeTHmVbqNIVFdqYadYZNuul+P/JswyG9jKX4nwlHRKvc145RXimoznRSppQxaPwrjijB
pkcPUhirUScyptTdZGFwu95xXlIqn+704CpOMn6C0hJatut4YHpthWxCtsp/vTPVIrFt
0Mrg==
X-Gm-Message-State: AOJu0Yy4tUz7Bzzf5cIDgPO9m08gFxELAsBp39cPRml/StGgdhFD0YTo
CsApfApr0fzL2On5wN6Lexq8l5zk5x2OS97tWvgTXevCqSelU82jWmKQ0571aX3j82j+wpFBI9i
B8TDuMUhi/Auq7JeCNj4twMFSNposlaSu+w==
X-Gm-Gg: ASbGncto4ICx5eiujtR5mC0u8QjhO17x248GC9dUIAHUkZFJkRHHj4u9WEfheG3uO/Q
PvIR9kdaozw3whusGLytXJDZoT+1EYA5UuNaobWPUfiYbKjEqEhoJMkhnBuzID/oIHAZtuX6GUD
MdgGr4lOAoccTysIalbEVEFjUfLDV+ckC+JZ2L5End/HOQ4Iqf29Nrsy+NheqK42HOJ0RyKYSsl
5EdQk7Cco28bcLnPn5M0iMnOkvIr8+bwMLXRLPmf1B66/Ni3qR+uOWCbZtu
X-Google-Smtp-Source: AGHT+IEuaH+uvFHErjpGs3dD7ccZqhVyC5ZahV7Gb83zWQej4hgqttSahoNtSJ7ti2knun2AxsgXPdgBXj5qrPP+uh0=
X-Received: by 2002:a05:6102:5093:b0:51c:77b:297c with SMTP id
ada2fe7eead31-5dd891b033dmr1882745137.27.1762368745637; Wed, 05 Nov 2025
10:52:25 -0800 (PST)
MIME-Version: 1.0
References: <m2frasiahb.fsf@HIDDEN>
In-Reply-To: <m2frasiahb.fsf@HIDDEN>
From: =?UTF-8?Q?St=C3=A9phane?= Marks <shipmints@HIDDEN>
Date: Wed, 5 Nov 2025 13:52:14 -0500
X-Gm-Features: AWmQ_blwFZtBkvu-hSSXGkaSQxnMvvEa3ju66Zdqjx7p0FnNy4IeoPjaFCnozg0
Message-ID: <CAN+1Hbr08WfmNQ4X0wQqV2FpghCJhYxFMbQ=Lqet0J15Dzc7Cg@HIDDEN>
Content-Type: multipart/alternative; boundary="0000000000000c0d8b0642dd7380"
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
--0000000000000c0d8b0642dd7380
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
On Wed, Nov 5, 2025 at 1:47=E2=80=AFPM Przemys=C5=82aw Alexander Kami=C5=84=
ski <
alexander@HIDDEN> wrote:
> This patch makes image type dictionary cache which prevents doing
> NSString allocations on every image type checks (around 40-60KiB per
> type check).
>
> This patch is stable, I've been using it for >2 months without any issues=
.
>
Ditto on sensible cache invalidation logic of some kind.
--0000000000000c0d8b0642dd7380
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gmail_default" style=3D"fon=
t-family:monospace"><span style=3D"font-family:Arial,Helvetica,sans-serif">=
On Wed, Nov 5, 2025 at 1:47=E2=80=AFPM Przemys=C5=82aw Alexander Kami=C5=84=
ski <<a href=3D"mailto:alexander@HIDDEN">alexander@HIDDEN</a>&=
gt; wrote:</span></div></div><div class=3D"gmail_quote gmail_quote_containe=
r"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;bord=
er-left:1px solid rgb(204,204,204);padding-left:1ex">This patch makes image=
type dictionary cache which prevents doing<br>
NSString allocations on every image type checks (around 40-60KiB per<br>
type check).<br>
<br>
This patch is stable, I've been using it for >2 months without any i=
ssues.<br></blockquote><div><br></div><div class=3D"gmail_default" style=3D=
"font-family:monospace">Ditto on sensible cache invalidation logic of some =
kind.</div></div></div>
--0000000000000c0d8b0642dd7380--
X-Loop: help-debbugs@HIDDEN
Subject: bug#79774: [PATCH] [NS] Image type cache
Resent-From: Eli Zaretskii <eliz@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Wed, 05 Nov 2025 19:40:01 +0000
Resent-Message-ID: <handler.79774.B79774.176237157717416 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 79774
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: =?UTF-8?Q?Przemys=C5=82aw?= Alexander =?UTF-8?Q?Kami=C5=84ski?= <alexander@HIDDEN>, Alan Third <alan@HIDDEN>
Cc: 79774 <at> debbugs.gnu.org
Received: via spool by 79774-submit <at> debbugs.gnu.org id=B79774.176237157717416
(code B ref 79774); Wed, 05 Nov 2025 19:40:01 +0000
Received: (at 79774) by debbugs.gnu.org; 5 Nov 2025 19:39:37 +0000
Received: from localhost ([127.0.0.1]:58920 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1vGjM0-0004Wq-L5
for submit <at> debbugs.gnu.org; Wed, 05 Nov 2025 14:39:36 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:40244)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1vGjLy-0004Wa-0X
for 79774 <at> debbugs.gnu.org; Wed, 05 Nov 2025 14:39:34 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
id 1vGjLq-0001JO-OB; Wed, 05 Nov 2025 14:39:27 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
Date; bh=Bb9S8EU9+n/j0v1Q9MpGQtPv/QFxx+l6EVKr8CQukDw=; b=K4W/MRxaZDizNsa86p5M
Em+uA74AkeI5Oeb7YvWi1MeNYba743u+6JC7hcmS5PzkYkfMTYtjqHzafx006MxVKFMpAiRKIUcZ9
FElCpWTFgIpTtARHfSwfcBtwfy9q5QRhvFdq5Qr6Q6EUARAEYyG/nExPcThiBOwecDq0mVr9LoeGc
Dp5w5Sox4PCupv/3d3zFP9ANJuqxxtPw74xFBp53hfkqfLCHl1k9RVBJ6PPl8P3gDKOZ8xlIHMHTn
y7yfzHYOmvpcPwtbeQlsQF6iSHqg7AS9N1rkl/S+GXvBRpHANVKlc09Q2e5RT06aZolfhw+GV+njZ
ASVMI6xFuPuF9A==;
Date: Wed, 05 Nov 2025 21:39:03 +0200
Message-Id: <86h5v8e0bs.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
In-Reply-To: <m2frasiahb.fsf@HIDDEN> (alexander@HIDDEN)
References: <m2frasiahb.fsf@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)
> From: Przemysław Alexander Kamiński
> <alexander@HIDDEN>
> Date: Wed, 05 Nov 2025 19:46:08 +0100
>
> This patch makes image type dictionary cache which prevents doing
> NSString allocations on every image type checks (around 40-60KiB per
> type check).
Thanks. Alan, any comments or suggestions?
X-Loop: help-debbugs@HIDDEN
Subject: bug#79774: [PATCH] [NS] Image type cache
Resent-From: Rudolf =?UTF-8?Q?Adamkovi=C4=8D?= <rudolf@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Fri, 07 Nov 2025 16:35:02 +0000
Resent-Message-ID: <handler.79774.B79774.176253324515897 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 79774
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: =?UTF-8?Q?Przemys=C5=82aw?= Alexander =?UTF-8?Q?Kami=C5=84ski?= <alexander@HIDDEN>, 79774 <at> debbugs.gnu.org
Received: via spool by 79774-submit <at> debbugs.gnu.org id=B79774.176253324515897
(code B ref 79774); Fri, 07 Nov 2025 16:35:02 +0000
Received: (at 79774) by debbugs.gnu.org; 7 Nov 2025 16:34:05 +0000
Received: from localhost ([127.0.0.1]:46814 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1vHPPY-00048K-Ki
for submit <at> debbugs.gnu.org; Fri, 07 Nov 2025 11:34:04 -0500
Received: from fout-a2-smtp.messagingengine.com ([103.168.172.145]:45855)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <rudolf@HIDDEN>)
id 1vHPPU-00047Z-Pi
for 79774 <at> debbugs.gnu.org; Fri, 07 Nov 2025 11:34:03 -0500
Received: from phl-compute-01.internal (phl-compute-01.internal [10.202.2.41])
by mailfout.phl.internal (Postfix) with ESMTP id 166F1EC025B;
Fri, 7 Nov 2025 11:33:55 -0500 (EST)
Received: from phl-mailfrontend-01 ([10.202.2.162])
by phl-compute-01.internal (MEProxy); Fri, 07 Nov 2025 11:33:55 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adamkovic.org;
h=cc:content-transfer-encoding:content-type:content-type:date
:date:from:from:in-reply-to:in-reply-to:message-id:mime-version
:references:reply-to:subject:subject:to:to; s=fm1; t=1762533235;
x=1762619635; bh=1HYnybx04yDb34W3mQteygrVeuO6OVSPLuCglokxDh0=; b=
BmO3IVUpzNmccifvGKEq2N5OnNuDpTmipqECB/enPl2ON8tAfFRjAHiIiBR74vfN
OXRIyfLixpKhhsmPloKOnabbGMsQK6NmWmL4LYjz67QV0GdDQVJvVyDvCVI3Vm1C
5kgre9PXMrhM+8Mmr3W3HVjflCak0xaz1/Rr0AQ5u04N2v5DO0pvJODPJvQ21UaI
sBRqPp5vFeXIT977sxYouLxLS0qkt4DcWGSqqeWlwsZN3Fy5vbqnoytcz6YjyF4f
Afchj4hpM6tYWuEFU7FGGKUX0kX9+umB+OJTZlrKpP3l7aeNNQooctlN6J4JESXS
PuGvcqY+Lthx1Y+0pSNbmg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
messagingengine.com; h=cc:content-transfer-encoding:content-type
:content-type:date:date:feedback-id:feedback-id:from:from
:in-reply-to:in-reply-to:message-id:mime-version:references
:reply-to:subject:subject:to:to:x-me-proxy:x-me-sender
:x-me-sender:x-sasl-enc; s=fm3; t=1762533235; x=1762619635; bh=1
HYnybx04yDb34W3mQteygrVeuO6OVSPLuCglokxDh0=; b=TH98q5rAsP0Bs1Mp2
aED1sfZ3CKdRzmDlVKT7kPCU6fx+YyObp5mOvBxHYoC+dmvjernP/s0Z2DPwpG7K
75IP0CC+8CgcRIlnzs5AYTKlF3FIVEd6k2a2211/gTRLMj+CjIzKLphpkMJgnOaA
80XwHk1OF/afWrHpwl+Co9+JGIuhFU7Bre/FaFuCUr+hTdY9Pyp60neoR8ly/sXt
HR+Gl3XeMjjhrIBs3LvIoNzjgIgKqr2lc1oahr9KYAJRbGnC47fkRjWBKA1SZfgt
+bYh7oh4Q0PJTDE18c84gEBZWR/H5vLCmJ1PTobRVZqNO5y7BHPsgohoAr0gCwRX
0rLQw==
X-ME-Sender: <xms:ch8Oaf5fF7K6BeNxNPPW8UIlbrSGppy6in31xCj-oQwnbAAHT4BsvA>
<xme:ch8Oaa6y7W4XdBwGkHsghE8L3QTUVTYIpQfd_K2bDgS-mLSmXsXC6nLe111hHUkLc
JdNJPOIjWjYXz1jpeXOKiKvXPC7Ihmz47btlp0IVvMME6C-YeQC9kQ>
X-ME-Received: <xmr:ch8OaUFebppCp8EQhmIlNSxq-CQsH46VSxLY9xjgDTfoWWZX7xTqK43srTDGDRjkWE0XA6yHfjHev2Zda2X7274frmv1kTA>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggdduledtudehucetufdoteggodetrf
dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu
rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf
gurhephffvufgjfhffkfggtgfgsehtqhertddttdejnecuhfhrohhmpeftuhguohhlfhcu
tegurghmkhhovhhitgcuoehruhguohhlfhesrggurghmkhhovhhitgdrohhrgheqnecugg
ftrfgrthhtvghrnhephefghffhfeetheeitdevffelffetveduteejkeehvdfhjeevvdeu
keehgfffheetnecuffhomhgrihhnpegruggrmhhkohhvihgtrdhorhhgnecuvehluhhsth
gvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprhhuugholhhfsegruggr
mhhkohhvihgtrdhorhhgpdhnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpohhuth
dprhgtphhtthhopeejleejjeegseguvggssghughhsrdhgnhhurdhorhhgpdhrtghpthht
oheprghlvgigrghnuggvrheskhgrmhhinhhskhhirdhsvg
X-ME-Proxy: <xmx:ch8OabTQclNJHSYVMyeifnoV65kz-wqk3Qcv-JQklwBDKLdrgNT6nw>
<xmx:ch8OaVsSGxf5axt41y_n14Q_NwYAXQ7j3vs2y1RyndtS6PpEe0gLiA>
<xmx:ch8OaSx-gJyqaZQPSorSzl77eEXEDlrJMkLuRkzFFTv5WwchhKCqrA>
<xmx:ch8OaX7zNWhqHS6U7YXvMW7efP4VXSh7qqRbR4e1U_3Jt3iXuD_BOQ>
<xmx:cx8OaT81kLKJFuij0_NhVor-daTRMU--5Tii4scT_fs7tMYHBiv_Rg_W>
Feedback-ID: i88214938:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri,
7 Nov 2025 11:33:53 -0500 (EST)
From: Rudolf =?UTF-8?Q?Adamkovi=C4=8D?= <rudolf@HIDDEN>
In-Reply-To: <m2frasiahb.fsf@HIDDEN>
References: <m2frasiahb.fsf@HIDDEN>
Date: Fri, 07 Nov 2025 17:33:52 +0100
Message-ID: <m21pm9ls3z.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.7 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)
Przemys=C5=82aw Alexander Kami=C5=84ski <alexander@HIDDEN> writes:
> + CFDictionaryGetValueIfPresent(image_api_dict, type,
^^^
space
:-)
Rudy
--=20
"It is better to have 100 functions operate on one data structure than
10 functions on 10 data structures."
--- Alan Perlis
Rudolf Adamkovi=C4=8D <rudolf@HIDDEN> [he/him]
http://adamkovic.org
X-Loop: help-debbugs@HIDDEN
Subject: bug#79774: [PATCH] [NS] Image type cache
Resent-From: Eli Zaretskii <eliz@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 25 Nov 2025 20:19:05 +0000
Resent-Message-ID: <handler.79774.B79774.17641019392063 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 79774
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: alan@HIDDEN
Cc: alexander@HIDDEN, 79774 <at> debbugs.gnu.org
Received: via spool by 79774-submit <at> debbugs.gnu.org id=B79774.17641019392063
(code B ref 79774); Tue, 25 Nov 2025 20:19:05 +0000
Received: (at 79774) by debbugs.gnu.org; 25 Nov 2025 20:18:59 +0000
Received: from localhost ([127.0.0.1]:41660 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1vNzV4-0000XB-98
for submit <at> debbugs.gnu.org; Tue, 25 Nov 2025 15:18:58 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:58550)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1vMk3r-0007s1-MG
for 79774 <at> debbugs.gnu.org; Sat, 22 Nov 2025 04:37:46 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
id 1vMk3a-0001sy-G4; Sat, 22 Nov 2025 04:37:26 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
Date; bh=XSlRx9P+/dHROtnjntL3RqAz1y6feASq9bquNxHqhtQ=; b=YhSxFU45qRotiDPcWsfB
c+jBGNkWAIN9RDP48wxsBrE2Jw/fbKA1CKs5817EduFPv6lmp4znJN4+fodAus/kp7qDpXRDVgDMS
C+EJwRSxqzVF+FVcNotEhZTsfKiozUVpW6Pb0MCeztFK3+ZJDz6xBiTMruKfbf2MkJm88LQvkjGOC
qiSY1kkXPpeNF21PWkB3VHAfVnx5zXJmH+PtcM5YtuOsTxae4D2qm92C6oiHq5ZNu36IrUMdnhzuH
L0dNCum8qIj940K+BS6mnqnFCmXj/9Va18n4ZCmNZQjKnjaoSPjujWPStxnWG02iD0IdM1n4Q9mQb
pAL7cVgqq7lEdA==;
Date: Sat, 22 Nov 2025 11:37:16 +0200
Message-Id: <867bvih0hf.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
In-Reply-To: <86h5v8e0bs.fsf@HIDDEN> (message from Eli Zaretskii on Wed, 05
Nov 2025 21:39:03 +0200)
References: <m2frasiahb.fsf@HIDDEN> <86h5v8e0bs.fsf@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)
Ping! Alan, could you please chime in?
> Cc: 79774 <at> debbugs.gnu.org
> Date: Wed, 05 Nov 2025 21:39:03 +0200
> From: Eli Zaretskii <eliz@HIDDEN>
>
> > From: Przemysław Alexander Kamiński
> > <alexander@HIDDEN>
> > Date: Wed, 05 Nov 2025 19:46:08 +0100
> >
> > This patch makes image type dictionary cache which prevents doing
> > NSString allocations on every image type checks (around 40-60KiB per
> > type check).
>
> Thanks. Alan, any comments or suggestions?
>
>
>
>
X-Loop: help-debbugs@HIDDEN
Subject: bug#79774: [PATCH] [NS] Image type cache
Resent-From: =?UTF-8?Q?Przemys=C5=82aw?= Alexander =?UTF-8?Q?Kami=C5=84ski?= <alexander@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 25 Nov 2025 20:22:06 +0000
Resent-Message-ID: <handler.79774.B79774.17641020753361 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 79774
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: Alan Third <alan@HIDDEN>, Eli Zaretskii <eliz@HIDDEN>
Cc: 79774 <at> debbugs.gnu.org
Received: via spool by 79774-submit <at> debbugs.gnu.org id=B79774.17641020753361
(code B ref 79774); Tue, 25 Nov 2025 20:22:06 +0000
Received: (at 79774) by debbugs.gnu.org; 25 Nov 2025 20:21:15 +0000
Received: from localhost ([127.0.0.1]:41774 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1vNzXG-0000s4-Rg
for submit <at> debbugs.gnu.org; Tue, 25 Nov 2025 15:21:15 -0500
Received: from fout-a3-smtp.messagingengine.com ([103.168.172.146]:55581)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <alexander@HIDDEN>)
id 1vMm9V-0006SV-LY
for 79774 <at> debbugs.gnu.org; Sat, 22 Nov 2025 06:51:43 -0500
Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46])
by mailfout.phl.internal (Postfix) with ESMTP id 6BA0AEC001A;
Sat, 22 Nov 2025 06:51:34 -0500 (EST)
Received: from phl-mailfrontend-02 ([10.202.2.163])
by phl-compute-06.internal (MEProxy); Sat, 22 Nov 2025 06:51:34 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kaminski.se; h=
cc:cc:content-transfer-encoding:content-type:content-type:date
:date:from:from:in-reply-to:in-reply-to:message-id:mime-version
:references:reply-to:subject:subject:to:to; s=fm1; t=1763812294;
x=1763898694; bh=tlWBsc1KQ04gg2Eh/FHzDhi64NeGomMWMx/c1/pKi+I=; b=
eCCC5f6i2v7HjH28NSQhllIVjSYp9BjUYhkbdetRhCuXD+NYu0q3k0ScnF6gueV9
JScxwPCAlE/c+svo/oldx0c8gq5LaeVytdic5lCiam0/Ya3+iU4RDyhX/p5eAeD8
UKjjZVeEmD26XArq5CPOObPZnHwXiNtbQNGRctfc+PNW4/UWOQvAYK4KZVLxzHdr
N5lL8Iimq+q6WgvSqyKV8HqrQ5Y03yb0ZQFuJu5u/q4DqvyLV2YKn7/O3WaY2nhD
EfZqdnzKHj/JGHPw2ASVTuZAgtaiA1dYvUkxUhimfIa7+gu7thypWP/MirVDVTX5
CZKf4KA7N68s6YUYQBT4mQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
messagingengine.com; h=cc:cc:content-transfer-encoding
:content-type:content-type:date:date:feedback-id:feedback-id
:from:from:in-reply-to:in-reply-to:message-id:mime-version
:references:reply-to:subject:subject:to:to:x-me-proxy
:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1763812294; x=
1763898694; bh=tlWBsc1KQ04gg2Eh/FHzDhi64NeGomMWMx/c1/pKi+I=; b=B
Entz/1AaWeIcoWi+4oSPcP6m+tT3/Ql7cyxJ52+VSyB2xDFw1cb/NofCHKio9uM6
DR1MwuBBCVaP4CMqfUF2A5nSfYJUnDxcrpUHSeuAfIZ3S+aEAh0T48/cwiR2neE5
B6/eDKtHFpulqbDBJPdXR4PTCCnRY5jyuZ7CYSOl6fA6VzaPu35UyHULKy41cLR4
a64co3+eGTm5qPL9u8TV8FFb4y4MnSQyC+yjD3uTP5VB4YLDEPGyh7hA4hNk9rcJ
b13MF6yNHmkGqcIAaF7ofW4+ytU1Wi2uLdTuW85ch/1KON9azgZuseE7JnmEY+LX
rdrz6oVHQ2NmI+D/kjxzw==
X-ME-Sender: <xms:xaMhacNFiOL0gw6YfGhe6Y7MgwQHPfxfNfrCV84af6iJxT6_uaiXaw>
<xme:xaMhaabdSP6W0hyACawr0AD0aAMZ-xXKiXzu7XQg0aLqMPmbn-xXPX5pekfSoVfrc
S5Bw3My6O6o5KPtkGOh-LBFkEJxpop595AiYKPbgk73lKGNqvk>
X-ME-Received: <xmr:xaMhaQqMrznyeUcYiOeuomPGT877LZQ3otmlEzi56kpZSTy4Mm7lbS6JBzhMYKspf57VGadGS_Jwj-GCbU88BRVeOEkW>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggddvfedvjeejucetufdoteggodetrf
dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu
rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf
gurhephffvvefujghffffkgggtgfesthhqredttddtjeenucfhrhhomheprfhriigvmhih
shhlrgifucetlhgvgigrnhguvghrucfmrghmihnkshhkihcuoegrlhgvgigrnhguvghrse
hkrghmihhnshhkihdrshgvqeenucggtffrrghtthgvrhhnpeejtdfffeffheehieffteej
veevtedtgfffudehleffveffkedvhffgtdefheevteenucffohhmrghinhepgihlihhird
hsphgrtggvpdgtohguvggsvghrghdrohhrghenucevlhhushhtvghrufhiiigvpedtnecu
rfgrrhgrmhepmhgrihhlfhhrohhmpegrlhgvgigrnhguvghrsehkrghmihhnshhkihdrsh
gvpdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopeej
leejjeegseguvggssghughhsrdhgnhhurdhorhhgpdhrtghpthhtohepvghlihiisehgnh
hurdhorhhgpdhrtghpthhtoheprghlrghnsehiughiohgthidrohhrgh
X-ME-Proxy: <xmx:xaMhaeYfkvWNPLQUcYnUju3Bu-oJMfhBbHbL2y0Aj_KYJ1Aara2kBA>
<xmx:xaMhaYS0SR5Uxj1S-3dLOck9XtFjAPxmX-FjqWxizTc2OvymCILK7A>
<xmx:xaMhaV710QkZJW2CyQlWCGg0lFkfpJEYoI0k7_cwhoHUrkJ9OgrsAg>
<xmx:xaMhadz2UvVF5q6ztR4pqSVmHLq-Q5Tu6fyn3kYLOF715nOesxJkbw>
<xmx:xqMhaaDgFfcN6kyQV71kTommLtH2IDW-whs9d8aCsppkRmRhLNrFjWYw>
Feedback-ID: i282146b2:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat,
22 Nov 2025 06:51:33 -0500 (EST)
From: =?UTF-8?Q?Przemys=C5=82aw?= Alexander =?UTF-8?Q?Kami=C5=84ski?=
<alexander@HIDDEN>
In-Reply-To: <aSGazap9nM19381f@HIDDEN>
References: <m2frasiahb.fsf@HIDDEN> <86h5v8e0bs.fsf@HIDDEN>
<867bvih0hf.fsf@HIDDEN> <aSGazap9nM19381f@HIDDEN>
Date: Sat, 22 Nov 2025 12:51:30 +0100
Message-ID: <m25xb2z3nh.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.7 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)
--=20
On Sat, Nov 22, 2025 at 11:13:17 (+0000), Alan Third wrote:
> On Sat, Nov 22, 2025 at 11:37:16AM +0200, Eli Zaretskii wrote:
>> Ping! Alan, could you please chime in?
>>=20
>> > Cc: 79774 <at> debbugs.gnu.org
>> > Date: Wed, 05 Nov 2025 21:39:03 +0200
>> > From: Eli Zaretskii <eliz@HIDDEN>
>> >=20
>> > > From: Przemys=C5=82aw Alexander Kami=C5=84ski
>> > > <alexander@HIDDEN>
>> > > Date: Wed, 05 Nov 2025 19:46:08 +0100
>> > >=20
>> > > This patch makes image type dictionary cache which prevents doing
>> > > NSString allocations on every image type checks (around 40-60KiB per
>> > > type check).
>> >=20
>> > Thanks. Alan, any comments or suggestions?
>
> Hi Alexander,
>
> What exact problem is this trying to solve? It says in the comment
> it's a memory leak, but the "outer" autorelease pool is initialised
> early enough that I don't believe there IS a leak.
Hi Alan,
Memory doesn't leak, but it allocates new memory area every
iteration. Goal of patch is to reduce VSIZE bloat and (what it looks like to
me) memory thrashing which is result of it.
> If the problem is simply that you think the autorelease pool is not
> releasing the memory fast enough, then have you tried wrapping the
> relevant code in its own autorelease pool?
It's releasing alright, but for some reason memory is not compacting. No id=
ea
why, I'm suspecting Emacs-NS implementation (oops, Eli, I forgot about
the description of the Emacs loop I promised to deliver, sorry!)
I can't tell right now what's the direct impact of this patch, but all
patches decrease temporal/persistent allocations ratio from 10:1 to 2:1.
Best,
Przemys=C5=82aw Alexander Kami=C5=84ski
--=20
Przemys=C5=82aw Alexander Kami=C5=84ski (vel xlii vel exlee)
https://xlii.space || https://codeberg.org/exlee
X-Loop: help-debbugs@HIDDEN
Subject: bug#79774: [PATCH] [NS] Image type cache
Resent-From: Alan Third <alan@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 25 Nov 2025 20:37:05 +0000
Resent-Message-ID: <handler.79774.B79774.176410298423399 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 79774
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: Eli Zaretskii <eliz@HIDDEN>
Cc: alexander@HIDDEN, 79774 <at> debbugs.gnu.org
Received: via spool by 79774-submit <at> debbugs.gnu.org id=B79774.176410298423399
(code B ref 79774); Tue, 25 Nov 2025 20:37:05 +0000
Received: (at 79774) by debbugs.gnu.org; 25 Nov 2025 20:36:24 +0000
Received: from localhost ([127.0.0.1]:42696 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1vNzlv-00065F-EH
for submit <at> debbugs.gnu.org; Tue, 25 Nov 2025 15:36:24 -0500
Received: from dane.soverin.net ([185.233.34.148]:47399)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.84_2) (envelope-from <alan@HIDDEN>) id 1vMlYV-0000xO-3V
for 79774 <at> debbugs.gnu.org; Sat, 22 Nov 2025 06:13:29 -0500
Received: from smtp.soverin.net (unknown [10.10.4.74])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
(No client certificate requested)
by dane.soverin.net (Postfix) with ESMTPS id 4dD8b31Nbtz11Y;
Sat, 22 Nov 2025 11:13:19 +0000 (UTC)
Received: from smtp.soverin.net (smtp.soverin.net [10.10.4.99]) by soverin.net
(Postfix) with ESMTPSA id 4dD8b25sTwz3n;
Sat, 22 Nov 2025 11:13:18 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin;
t=1763809999; bh=uglUEwXWYkL5cDOqESP0NH3IU89Es34Y2lAo1sSIE2o=;
h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
b=hKm8I5pvNbZvk0QrD2ZzQEci61K6zNxxCyyf+13pWPKld2tauz8+qkU1JEu5sbDvW
BAMOQPgzPoRIbg8LcJiB+qEZi49ZsXm5ApZKJ8o7tSW1hJdY/G99yjitH7czYA2vxr
Tr92xSXfJsyMu/uiQupijFFoM7yLaxTq52t+/V3GCat2gnvBhrZ47Cyu/ltUqsNY4S
nFzHPEAWyyfLlNg1QkX8+ZzYo3p8tZK3kSUVg+5yrepoKGqB3TbEznARqsZRxLtYvL
fhvLpzazc/O/7gBlVlSqnniHu3zlerLtSe865TGhE6+Kfg2kjdVlfRs3+QXNQEbSSH
jOpV7PlXgCgxg==
X-CM-Envelope: MS4xfD2Ef364VISsjxuUYDi4NBD5t3pr0TR49tI5VKtXDct/d6ePjAlp+V/0IDbshbQTXwqJxLJyudVMfkpfhMHeXm20Mw2WAGYPi3O6E1U4qv5VNjTFB3pv
z9lOPwqUo4dW5k1SOUx6xRK9OrNikskinPyifxX5Y3bi8OBd4xhmFo4IJv3SgRTlgsnS+8nY5sYPxOM/rcznjbxRinpiCxmLwKkIodNPijHud7VGGnvbi6Os
red5mjYFcBSK2vt9unGr2q+nbbaQQ0QZVnOSyQY/yrQ=
X-Soverin-Id: 019aab44-b4b0-7f36-9e08-5f184517d5ee
Received: from localhost (faroe.holly.idiocy.org [local])
by faroe.holly.idiocy.org (OpenSMTPD) with ESMTPA id 0488cf7b;
Sat, 22 Nov 2025 11:13:18 +0000 (UTC)
Date: Sat, 22 Nov 2025 11:13:17 +0000
From: Alan Third <alan@HIDDEN>
Message-ID: <aSGazap9nM19381f@HIDDEN>
Mail-Followup-To: Alan Third <alan@HIDDEN>,
Eli Zaretskii <eliz@HIDDEN>, alexander@HIDDEN,
79774 <at> debbugs.gnu.org
References: <m2frasiahb.fsf@HIDDEN> <86h5v8e0bs.fsf@HIDDEN>
<867bvih0hf.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <867bvih0hf.fsf@HIDDEN>
X-Spampanel-Class: ham
X-Spam-Score: -0.7 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)
On Sat, Nov 22, 2025 at 11:37:16AM +0200, Eli Zaretskii wrote:
> Ping! Alan, could you please chime in?
>
> > Cc: 79774 <at> debbugs.gnu.org
> > Date: Wed, 05 Nov 2025 21:39:03 +0200
> > From: Eli Zaretskii <eliz@HIDDEN>
> >
> > > From: Przemysław Alexander Kamiński
> > > <alexander@HIDDEN>
> > > Date: Wed, 05 Nov 2025 19:46:08 +0100
> > >
> > > This patch makes image type dictionary cache which prevents doing
> > > NSString allocations on every image type checks (around 40-60KiB per
> > > type check).
> >
> > Thanks. Alan, any comments or suggestions?
Hi Alexander,
What exact problem is this trying to solve? It says in the comment
it's a memory leak, but the "outer" autorelease pool is initialised
early enough that I don't believe there IS a leak.
If the problem is simply that you think the autorelease pool is not
releasing the memory fast enough, then have you tried wrapping the
relevant code in its own autorelease pool?
--
Alan Third
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.