From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Arthur Miller Newsgroups: gmane.emacs.devel Subject: Re: Image transforms as a benchmark? Date: Sun, 12 Sep 2021 15:28:09 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16160"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Alan Third Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Sep 12 15:29:12 2021 Return-path: Envelope-to: ged-emacs-devel@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 1mPPXj-0003yf-9v for ged-emacs-devel@m.gmane-mx.org; Sun, 12 Sep 2021 15:29:12 +0200 Original-Received: from localhost ([::1]:44048 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mPPXh-0002cu-DL for ged-emacs-devel@m.gmane-mx.org; Sun, 12 Sep 2021 09:29:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52616) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPPWq-0001vI-Nf for emacs-devel@gnu.org; Sun, 12 Sep 2021 09:28:17 -0400 Original-Received: from mail-am6eur05olkn2030.outbound.protection.outlook.com ([40.92.91.30]:32193 helo=EUR05-AM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPPWn-0003bJ-Vb for emacs-devel@gnu.org; Sun, 12 Sep 2021 09:28:16 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cnNqxYch6Q98SorYAlmR7lPUAe69RsF8FEt1LoQ73ai/gCR64RDPWfY0hxUHEdrBmDAI+YB6qXlUtDRlpaIinWBbXZpuFdmdD3d0kB5azZdcEKY/So8zncTw8JEcoPfwZMqnMoIIuYayPLV9qrykwADqidEaO2mUgdk4wshB7zHujCdn3U9gQPQFZgjoeynHXvOOYyHb4pWMgfWSsHSdP1VyY0w6L4XWg+SGDFzwrh580FDVU4Zu7g/gxbxFqxoUD7DzAecyuCSw+Dml2ZKjio5+KPospMUI8FHshRz0n6tCh0JVyl62MTfuuo2rk16dhNAqUvvRAERxfZkog33g/w== 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=eFopISj7MS1biVjNmEQAzb9cDjqAugbbMG6ahdE2YWQ=; b=BxAm+r/QU7USUKTdkU4qIA1/c5JQHx46/zoUsA0c5EJbYUCplZX9nEcr2QgOqMPVLQ0HJhnGiSL79g8SYRUlxmQK2YTIOKkHXn0LHO1PIYoMe59IUxOuVANLkasP+nwmjS6NIDnUv4VIPn2BhZJzPNthR1zPBrzeY39K8tFQmaRFDWrfTfOYg76OFU8fhMwgssq1E4WDKD+/pwF897HTbix3RY/V2E7Xp4IFawnP033Inmesd0lXLst0bSS4g/fxz7IGU2lxa4D8ENh8zCcL3imV0RkbwL6DMO807pWBq1YyYQrYDEBLc3HTAdxFuHyNJdtMgZuBG8Ohe++ZoaxZjg== 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=eFopISj7MS1biVjNmEQAzb9cDjqAugbbMG6ahdE2YWQ=; b=QVPvt03OOuopKIO0OSksqGSpMfcmgdVW5A5KHj1ANQnOB0WEb+nnI4yLAVB/08wTabzRKnoKub27BuTtwzpK6s0sfDQ3g1ZQIJak07NrYStgredBNDOqXqDPsA/Xrwc2bhh6rAuriN3YBtUURm3tToki1WMwy1b0iSRaLchpT11PAtw1pWszLYkbmlXaBHy6MwJK1vaiI8gFEWEsCrOA8Fh6wTIosrbBcWwDn+wsFq81cGW0GH2qCFnr1QKfbg08dNHIsYE4Z8Ysfi0miDNiSdIfRkw33T7mDU+tpXzLSAppLZ4wvDGi2YFr0+2hhmdq7uKGRbFkRLvxjyclAKdwBQ== Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) by AM0PR09MB2770.eurprd09.prod.outlook.com (2603:10a6:208:128::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.18; Sun, 12 Sep 2021 13:28:10 +0000 Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::c55c:ece5:bed2:a9dc]) by AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::c55c:ece5:bed2:a9dc%8]) with mapi id 15.20.4500.018; Sun, 12 Sep 2021 13:28:10 +0000 In-Reply-To: (Alan Third's message of "Sun, 12 Sep 2021 13:12:04 +0100") X-TMN: [bTM/v4f88ca0h1zkzeN4f74qgMD3/fFO] X-ClientProxiedBy: AS9PR06CA0327.eurprd06.prod.outlook.com (2603:10a6:20b:45b::22) To AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) X-Microsoft-Original-Message-ID: <87ilz57wk6.fsf@live.com> X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from pascal.homepc (81.232.177.30) by AS9PR06CA0327.eurprd06.prod.outlook.com (2603:10a6:20b:45b::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.15 via Frontend Transport; Sun, 12 Sep 2021 13:28:10 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6cc9b4ff-4e84-4271-3434-08d975f12a07 X-MS-TrafficTypeDiagnostic: AM0PR09MB2770: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fSsKW9AEcnWBMkut0Xz/zzWmj0pkjXLOXsQFWeHas1fOdvpcdKePLWE3pAVMC393TMnc1cMvgOYUR+56dzthROfm7oEfknpk2gWFqqA+Hk3U13G1xGgPD1lNczFyZJMSmbY8gTDYRz289hKX7ug7AuZE92rtvX1G3qw7lhR2lzwD0/DP2d6eeZiSb7ArPFcV/XGY+GXcJmtVQ7CB+O0kyy1ge7OIjjEr3Grd3flDmEktuzcXiwv0fVQdlRDAHQVWysQet2QJD8qCx1h+XBLVikAXPRASf3sXIOn+/MeKOlmqIaML5YbHQ/590mXaqPqBk9JLZsPAppV+f6NIjQ9FadxMkFy6ovz7O1m5zI88IURVelocofep0D5jaVCyCudU5nXp1zsuQCEEsLhVXitGQ/qIGCKRmB3YyOMI+i6l5jKIKo34m+Jtzi3C79lCy8pf X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: l9yoJX8qdYxcSD4NU6C5wr5IFK0SHPzWmkf1es2OUpBm4AKBn6x7LdzKxA0O0J7eqD1gGWXQensYqRRobMXUuzWuVAAkY9Ls/XQCjLrz7rP6dDN5peDEKT9dGmGUhxURm531mU/5uMAZR6bcemtN/Q== X-OriginatorOrg: sct-15-20-3174-20-msonline-outlook-72e6e.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 6cc9b4ff-4e84-4271-3434-08d975f12a07 X-MS-Exchange-CrossTenant-AuthSource: AM9PR09MB4977.eurprd09.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Sep 2021 13:28:10.7108 (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: AM0PR09MB2770 Received-SPF: pass client-ip=40.92.91.30; envelope-from=arthur.miller@live.com; helo=EUR05-AM6-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, FREEMAIL_FROM=0.001, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:274593 Archived-At: Alan Third writes: > On Sun, Sep 12, 2021 at 01:45:39PM +0200, Arthur Miller wrote: >> >> I tried to make another little benchmark, I saw with optimization flags, that >> quite some loops have got unrolled and vectorized in image.c, so I wanted to see >> if it matters when doing some transforms on images. I tested so far just with >> svg. >> >> I wonder if image-rotate is handled completely by external libraries? I see >> no effect on performance, regardless of how many time I rotate some image. Is it >> same situation for scaling down? I see big difference when scaling up images so >> I guess that is handled by Emacs own code? > > SVG is probably not a great example for testing image transforms, at > least if you're using the master branch. I wanted to make few benchmarks that are relevant to normal use. I do some searches, replacements and similar in a big text buffer (Plat's dialoagues as I posted a day before), and I did some symbol lookups in Emacs lisp sources. SVG is getting a bit of uprise lately, so thought it might matter. But I'll guess I'll skip SVG then. > Image scaling in SVG is handled at the time the image is rasterized, > so if you ask for the image to be doubled in size, the rasterizer > creates a bitmap that is twice the size. Yes, I saw the code. But I wasn't sure if it does upscaling itself, or it outsources the entire venture to librsvg & co. I understand the most of image operations are handled by 3rd party libraries. I saw some code for image transforms in image.c, but I haven't looked much where it is used and so, maybe I should have :). Why is it so drammatic difference then when scaling up compared to scaling down? It takes like 5 seconds to do that loop in scale-up test, but just a fraction of a second when scaling down. I tested little different versions, and I see the effect, so scaling is done. > A PNG, for example, is not scaled in this way. When we ask the > graphics toolkit to draw it, we ask for to draw it at twice the size. > Ideally this should be done in the graphics hardware, so Emacs only > ever handles the unscaled image data. > > The same holds for rotation for both SVG and bitmap formats. The > toolkit is asked to perform the final rotation, ideally in hardware. > > I say toolkit, but in X it's actually the X server itself we ask > through XRender, which as described above should hand that off to the > graphics hardware. > > I'm unsure what loops might be unrolled within image.c, I'd guess it's > probably loops relating to creating images and image masks. > > You could perhaps try stepping through the frames of an animated GIF. > Our rendering algorithm is rather... inefficient. I am not sure how to write such test. I'll see, never really worked with gifs in Emacs. Thanks both for clarifications.