unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Third <alan@idiocy.org>
To: Arthur Miller <arthur.miller@live.com>
Cc: emacs-devel@gnu.org
Subject: Re: Image transforms as a benchmark?
Date: Sun, 12 Sep 2021 13:12:04 +0100	[thread overview]
Message-ID: <YT3ulFE+dayz9BR9@idiocy.org> (raw)
In-Reply-To: <AM9PR09MB497767C7F6D2AC76C5D1C08496D89@AM9PR09MB4977.eurprd09.prod.outlook.com>

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



  reply	other threads:[~2021-09-12 12:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-12 11:45 Image transforms as a benchmark? Arthur Miller
2021-09-12 12:12 ` Alan Third [this message]
2021-09-12 13:28   ` Arthur Miller
2021-09-12 15:50     ` Alan Third
2021-09-12 17:50       ` Arthur Miller
2021-09-12 12:17 ` Eli Zaretskii
2021-09-12 13:29   ` Arthur Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YT3ulFE+dayz9BR9@idiocy.org \
    --to=alan@idiocy.org \
    --cc=arthur.miller@live.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).