From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#69992: Minor improvement to image map transformation logic Date: Wed, 27 Mar 2024 15:17:31 -0700 Message-ID: <87cyrfl265.fsf@breatheoutbreathe.in> References: <87o7b3m8ee.fsf@ushin.org> <55864577-3819-46e0-857a-cc0d0145bc2f@orange.fr> <86cyrfj0t3.fsf@gnu.org> Reply-To: Joseph Turner Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25145"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , 69992@debbugs.gnu.org To: David Ponce Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Mar 27 23:51:27 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rpc7D-0006M3-5F for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 27 Mar 2024 23:51:27 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rpc6r-0004DS-MJ; Wed, 27 Mar 2024 18:51:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rpc6p-0004Cf-2O for bug-gnu-emacs@gnu.org; Wed, 27 Mar 2024 18:51:03 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rpc6o-0005KF-Lv for bug-gnu-emacs@gnu.org; Wed, 27 Mar 2024 18:51:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rpc6n-0007bF-QN for bug-gnu-emacs@gnu.org; Wed, 27 Mar 2024 18:51:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Joseph Turner Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 27 Mar 2024 22:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69992 X-GNU-PR-Package: emacs Original-Received: via spool by 69992-submit@debbugs.gnu.org id=B69992.171157986029202 (code B ref 69992); Wed, 27 Mar 2024 22:51:01 +0000 Original-Received: (at 69992) by debbugs.gnu.org; 27 Mar 2024 22:51:00 +0000 Original-Received: from localhost ([127.0.0.1]:38508 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rpc6l-0007ap-5C for submit@debbugs.gnu.org; Wed, 27 Mar 2024 18:51:00 -0400 Original-Received: from out-175.mta1.migadu.com ([2001:41d0:203:375::af]:41389) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rpc6h-0007a4-6e for 69992@debbugs.gnu.org; Wed, 27 Mar 2024 18:50:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=breatheoutbreathe.in; s=key1; t=1711579848; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=gFMWfO63LTjF0aopC2JnpqhWMLukqoBTsRUqisYZM20=; b=etLJSxirezko56p4ctOVsGwIfSP0KfNFWZa7TjYDOc0Tq0CSCevLS31xlxVI2HD2kSI24X 2jnOHK0DXa6g5XKXrEWaQiKM/HxSvuujLLxECUjJzN9QYhh/TGORcL73vRaEkn5UZsX2G9 YWUSKrPb2Utu+d0Aj4c/DdpaWkugnBg= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. In-reply-to: X-Migadu-Flow: FLOW_OUT X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:282164 Archived-At: David Ponce writes: > On 27/03/2024 13:50, Eli Zaretskii wrote: >>> Date: Wed, 27 Mar 2024 12:16:11 +0100 >>> From: David Ponce via "Bug reports for GNU Emacs, >>> the Swiss army knife of text editors" >>> >>> Many thanks for this feature, which is particularly useful to >>> automatically recalculate the map of computed images like SVG. You're welcome! >>> To make the code faster, by avoiding multiple scans of the map for >>> copy and parsing, I propose the following patch which factors most of >>> the code into the functions `image--compute-map' and `image--compute >>> -original-map'. I have done some tests on my side which are >>> conclusive. Thanks for reviewing and optimizing this feature. Please share the tests/benchmarks that you've performed. >>> Furthermore, I wonder if the term :base-map would not be more >>> descriptive than :original-map? I am fine with changing :original-map to :base-map. If you want to do this, I suggest making this change in its own commit which also updates the relevant docstrings and manual pages. >> Thanks. >> Joseph, any comments or suggestions? On my machine, not all tests pass with the patch. Please be sure that these three new tests pass: image-create-image-with-map image--compute-map-and-original-map image-transform-map Personally, I find it easier to understand image map transformation when the logic is split into multiple functions. However, the benefit of readability could certainly be outweighed by a noticeable improvement to user experience. Please share some benchmarks. Please keep in mind that `image--delayed-change-size' already debounces image transformation, so this code may not be so performance-critical. Thank you, Joseph > Attached the same patch slightly cleaned up. > > [2. text/x-patch; image.el-compute-map-V1.patch]...