unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Alex Gramiak <agrambot@gmail.com>
To: Daniel Pittman <slippycheeze@google.com>
Cc: Eli Zaretskii <eliz@gnu.org>, emacs-devel <emacs-devel@gnu.org>
Subject: Re: Removing assumption of unsigned long pixel values for colours
Date: Mon, 06 May 2019 10:11:27 -0600	[thread overview]
Message-ID: <878svjk1g0.fsf@gmail.com> (raw)
In-Reply-To: <CAC45yQuSRSdNo3LhH4MgaGH3VViD5iO9dx=u+60A1p7EC4HWnQ@mail.gmail.com> (Daniel Pittman's message of "Mon, 6 May 2019 10:13:04 -0400")

Daniel Pittman <slippycheeze@google.com> writes:

> If you wanted to explore the optimization (and because I was curious, personally):
> https://godbolt.org/z/vC_yOg
>
> You can change the width of the representation, and possibly even use signed int color values (untested), to see the effect it has.  spoiler alert, pretty much none, even with a 64-bit integer for each color value.
>
> Even using a relatively old compilers, gcc 4.1.2 from February 13, 2007, the compiled results are quite efficient.
> See the LLVM-MCA analysis, but your costs seem well within reasonable limits to me.
>
> I don't think I'd cache it either: at around 14 cycles per conversion, it is around 5.3ns to run, and fetching from in the L1 cache is around 9ns, so your best case scenario is that you took 60 percent longer to fetch it than to convert it, excluding
> CPU stalls from other activity.

Thanks for exploring this! It's good to see that the results are
efficient.

> So, benchmark if you want, but I'm pretty sure you can't win much back by doing the conversion only once, rather than inline at execution time.

The original plan was to avoid any conversion at all (no conversion
necessary on the Emacs side to create the struct of doubles); would you
still consider the difference between no conversion and 4 conversions to
be negligible?



  reply	other threads:[~2019-05-06 16:11 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-04 18:08 Removing assumption of unsigned long pixel values for colours Alex Gramiak
2019-05-04 18:39 ` Eli Zaretskii
2019-05-04 23:04   ` Alex Gramiak
2019-05-05 16:14     ` Eli Zaretskii
2019-05-05 19:35       ` Alex Gramiak
2019-05-06  2:45         ` Eli Zaretskii
2019-05-06 14:13           ` Daniel Pittman
2019-05-06 16:11             ` Alex Gramiak [this message]
2019-05-06 16:51               ` Stefan Monnier
2019-05-06 20:03                 ` Alex Gramiak
2019-05-06 15:11           ` Alex Gramiak
2019-05-06 15:45             ` Eli Zaretskii
2019-05-06 16:29               ` Alex Gramiak
2019-05-06 16:54                 ` Eli Zaretskii
2019-05-06 17:14                   ` Alex Gramiak
2019-05-06 17:39                     ` Eli Zaretskii
2019-05-06 18:00                       ` Eli Zaretskii
2019-05-06 19:49                         ` Alex Gramiak
2019-05-07  2:29                           ` Eli Zaretskii
2019-05-06  8:12     ` Alan Third
2019-05-06  9:18       ` mituharu
2019-05-06 15:06       ` Eli Zaretskii

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=878svjk1g0.fsf@gmail.com \
    --to=agrambot@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=slippycheeze@google.com \
    /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).