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

[-- Attachment #1: Type: text/plain, Size: 1273 bytes --]

>
>
> > It's certainly possible that I'm overestimating the cost of the
> > conversions. It just doesn't seem good to have to do this conversion for
> > every draw operation.
> >
> > Perhaps I should follow the old adage and just use unsigned long with
> > conversions first and benchmark after.
>
> Yes, please.
>

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.

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.

[-- Attachment #2: Type: text/html, Size: 1838 bytes --]

  reply	other threads:[~2019-05-06 14:13 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 [this message]
2019-05-06 16:11             ` Alex Gramiak
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='CAC45yQuSRSdNo3LhH4MgaGH3VViD5iO9dx=u+60A1p7EC4HWnQ@mail.gmail.com' \
    --to=slippycheeze@google.com \
    --cc=agrambot@gmail.com \
    --cc=eliz@gnu.org \
    --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).