[Top][All Lists]

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

Re: Removing assumption of unsigned long pixel values for colours

From: Alex Gramiak
Subject: Re: Removing assumption of unsigned long pixel values for colours
Date: Mon, 06 May 2019 10:11:27 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux)

Daniel Pittman <address@hidden> 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

> 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 via email to

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