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 16:50:12 +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="22842"; 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 17:52:25 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 1mPRmK-0005i5-O9 for ged-emacs-devel@m.gmane-mx.org; Sun, 12 Sep 2021 17:52:24 +0200 Original-Received: from localhost ([::1]:59848 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mPRmJ-0005PA-8d for ged-emacs-devel@m.gmane-mx.org; Sun, 12 Sep 2021 11:52:23 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39232) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPRkM-00044T-AP for emacs-devel@gnu.org; Sun, 12 Sep 2021 11:50:23 -0400 Original-Received: from outbound.soverin.net ([2a01:4f8:fff0:65::8:228]:48545) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPRkI-00067o-Q9 for emacs-devel@gnu.org; Sun, 12 Sep 2021 11:50:21 -0400 Original-Received: from smtp.soverin.net (unknown [10.10.3.24]) (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 E9E8851; Sun, 12 Sep 2021 15:50:14 +0000 (UTC) Original-Received: from smtp.soverin.net (smtp.soverin.net [159.69.232.138]) by soverin.net DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin; t=1631461814; bh=XtLnlSyHWH4q6GaKA9e1NFprs1U07FlhfK+TVPipO34=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=FVHpWw+YTZ4FBnkBrSTOpVrJuTBBJk0NN2D9DVvWSujIDw/j/mL38Z/47ykXyuN3Y eb/YlQ2q9jQSX5qou2mOPiqSZyUj/XT6oF5qQC5ZEsarndiXIpHbusaOfvwirdQLKZ QrCsTaJ1aNU2cohDx2ci2bzIMiBGvUE7rx8+81R+WF1boohIgPGrqUPSWe66YoAx3r btYikwakD7euUQXbz/2yOZ75aOryaf8VCzVNFdRslHBrwcrp/Dgu5FEcjemM7/pH1G sVJCBrsDUlXANfBbKRlFUHwE9agY51p/Y5GMRJMvj4waPXslElAE7IMDUM8j4C0i9J u+zCPco/JKu/g== Original-Received: from alan by faroe.holly.idiocy.org with local (Exim 4.94.2) (envelope-from ) id 1mPRkC-001h0l-6G; Sun, 12 Sep 2021 16:50:12 +0100 Mail-Followup-To: Alan Third , Arthur Miller , emacs-devel@gnu.org Content-Disposition: inline In-Reply-To: Received-SPF: pass client-ip=2a01:4f8:fff0:65::8: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:274596 Archived-At: On Sun, Sep 12, 2021 at 03:28:09PM +0200, Arthur Miller wrote: > 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. Well, don't let me put you off if you're bench-marking things that actually matter. I assumed it was a purely intellectual exercise. > > 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. I have no idea. Both scaling up and down are performed by librsvg itself. It may be some side-effect of the way we do the scaling, with the wrapped SVG, but I don't have enough knowledge of librsvg to know why. Alternatively we're doing something wrong that I haven't noticed. Is it possible to use a profiler to find out which calls are slow? > > 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. If it doesn't matter to you, it's probably not worth your while. We know why it's slow (we need to cache the intermediate images). -- Alan Third