From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Third Newsgroups: gmane.emacs.devel Subject: Re: Image transforms as a benchmark? Date: Sun, 12 Sep 2021 13:12:04 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33624"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Arthur Miller Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Sep 12 14:14:18 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 1mPONG-0008VJ-ED for ged-emacs-devel@m.gmane-mx.org; Sun, 12 Sep 2021 14:14:18 +0200 Original-Received: from localhost ([::1]:56912 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mPONE-0008Td-HA for ged-emacs-devel@m.gmane-mx.org; Sun, 12 Sep 2021 08:14:16 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36250) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPOLG-0006sB-JL for emacs-devel@gnu.org; Sun, 12 Sep 2021 08:12:15 -0400 Original-Received: from outbound.soverin.net ([116.202.126.228]:37321) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPOLE-0008Tb-ET for emacs-devel@gnu.org; Sun, 12 Sep 2021 08:12:14 -0400 Original-Received: from smtp.soverin.net (unknown [10.10.3.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by outbound.soverin.net (Postfix) with ESMTPS id 094FB51; Sun, 12 Sep 2021 12:12:08 +0000 (UTC) Original-Received: from smtp.soverin.net (smtp.soverin.net [159.69.232.142]) by soverin.net DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin; t=1631448727; bh=4ypaAtzfl9F4eA100pCCT/xYAq0olgYb4qwbzHSXS/8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=gZ5ea+GT9qAy39CfFs1E3Ap2/z2MTbcwDjtgvllEXAW4wSr3wuldGbXneuobRpkiG FO8gwO44exOSOXuPAYSfTKVtpSHqtO6dMBSdKv3SExO30lMyqtWW6wo6ibn3aSkG0j Lyqk08JSUCtFuEYU/5BMru+xpU8F4r7Kd9PhY/s4i6y9mapY5Mxj75hacCpsBzuxfe 0xmxzeNMWyZL+LnBrCQu2FmUxx5LGulC3CdbH8bOgRlKivcTjsPvuAQj/X6DRYSbVN nT283s/+xdWpBEsV0v3EhYRDEc9koiZzwLdsvc7HnjDzxtedxTZQGXkPNofVRsz+uA li5Ljzork7S2A== Original-Received: from alan by faroe.holly.idiocy.org with local (Exim 4.94.2) (envelope-from ) id 1mPOL6-001dQJ-V9; Sun, 12 Sep 2021 13:12:04 +0100 Mail-Followup-To: Alan Third , Arthur Miller , emacs-devel@gnu.org Content-Disposition: inline In-Reply-To: Received-SPF: pass client-ip=116.202.126.228; envelope-from=alan@idiocy.org; helo=outbound.soverin.net 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, 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:274590 Archived-At: 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. 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. 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. -- Alan Third