From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: David Ponce 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: Thu, 28 Mar 2024 00:53:26 +0100 Message-ID: <0feeb39d-f2c5-4109-adce-23df2ab443a4@orange.fr> References: <87o7b3m8ee.fsf@ushin.org> <55864577-3819-46e0-857a-cc0d0145bc2f@orange.fr> <86cyrfj0t3.fsf@gnu.org> <87cyrfl265.fsf@breatheoutbreathe.in> Reply-To: David Ponce Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26369"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: Eli Zaretskii , 69992@debbugs.gnu.org To: Joseph Turner Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Mar 28 00:54:33 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 1rpd6F-0006aQ-1k for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 28 Mar 2024 00:54:31 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rpd5n-0003Em-EV; Wed, 27 Mar 2024 19:54:03 -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 1rpd5l-0003Ec-Ts for bug-gnu-emacs@gnu.org; Wed, 27 Mar 2024 19:54:01 -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 1rpd5l-00055d-Lj for bug-gnu-emacs@gnu.org; Wed, 27 Mar 2024 19:54:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rpd5l-0004pl-LO for bug-gnu-emacs@gnu.org; Wed, 27 Mar 2024 19:54:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: David Ponce Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 27 Mar 2024 23:54: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.171158361818389 (code B ref 69992); Wed, 27 Mar 2024 23:54:01 +0000 Original-Received: (at 69992) by debbugs.gnu.org; 27 Mar 2024 23:53:38 +0000 Original-Received: from localhost ([127.0.0.1]:38536 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rpd5L-0004m0-Ve for submit@debbugs.gnu.org; Wed, 27 Mar 2024 19:53:37 -0400 Original-Received: from smtp-79.smtpout.orange.fr ([80.12.242.79]:53134 helo=msa.smtpout.orange.fr) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rpd5F-0004kS-S5 for 69992@debbugs.gnu.org; Wed, 27 Mar 2024 19:53:33 -0400 Original-Received: from [192.168.1.15] ([2.7.71.181]) by smtp.orange.fr with ESMTPA id pd5DrHChJjqu9pd5DrQ6sv; Thu, 28 Mar 2024 00:53:28 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=orange.fr; s=t20230301; t=1711583608; bh=/9wndxdCOhi68zlQTQMZ7D966B6KC685neBWd83ARak=; h=Message-ID:Date:MIME-Version:Subject:To:From; b=fymYhlRpC7961VpcdVl2CkXVGVV5ypTmg9ylTmSJlDKREXO9TAFnNOemnWElYGRyw c8xGinGfdMkdYcywKlYNwbJEk2HjwzdWpHfSWJadyvrlBz8POJcM9UR/eJiG8Q0ft/ JsaTIVhjzWRQzKqAUePvIw3zbmIwkvkj/PCVVo9ciYEjrUJsUrq9bFwUd5n7IXwHu8 fduwnaA/5k0hU3MZ6cDoFx5xX7nhhkMCxl7fw6a8B69OnN+jiQ+CQQXwcJi0kDqeu+ qXvCqPjtUbgbPyXxTQIPiRwqysTDECnp5HgcWhhH9q7r38l9HR121CMYbqlgkcox+A /KZ96AvToa+0A== X-ME-Helo: [192.168.1.15] X-ME-Auth: ZGFfdmlkQHdhbmFkb28uZnI= X-ME-Date: Thu, 28 Mar 2024 00:53:28 +0100 X-ME-IP: 2.7.71.181 Content-Language: fr, en-US In-Reply-To: <87cyrfl265.fsf@breatheoutbreathe.in> 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:282167 Archived-At: On 27/03/2024 23:17, Joseph Turner wrote: > > 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. OK >>>> 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. I was just wondering. If everyone is happy with :original-map, I'm fine with it. >>> 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 Maybe some tests didn't pass because with my patch the computed hot spots are pushed in a new map in reverse order? I will have a look at this as soon as possible. > 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. In this case, I have the opposite feeling ;-) I find harder to read the logic splits into multiple functions that operate by side effect on hot spots coords. But it could be just me :-) > Please keep in mind that `image--delayed-change-size' already debounces > image transformation, so this code may not be so performance-critical. Related to `image--delayed-change-size', you are probably right. My concern is more about computed images and associated maps (I use such kind of images+maps in computed SVG buttons grids). In this case it could be interesting to keep `create-image' as efficient as possible. > Thank you, You are welcome! Thank you for your feedback! > > Joseph > >> Attached the same patch slightly cleaned up. >> >> [2. text/x-patch; image.el-compute-map-V1.patch]... >