emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Removing assumption of unsigned long pixel values for colours


From: Daniel Pittman
Subject: Re: Removing assumption of unsigned long pixel values for colours
Date: Mon, 6 May 2019 10:13:04 -0400


> 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):

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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]