[Mesa-dev] [PATCH excerpt] mesa: Wrap unlikely() around conditions leading to _mesa_error().

Eric Anholt eric at anholt.net
Mon Mar 2 15:03:00 PST 2015


Kenneth Graunke <kenneth at whitecape.org> writes:

> Generated by the following Coccinelle semantic patch:
>
> @@
> expression E;
> @@
> if (
> -E
> +unlikely(E)
>  )
> { ... _mesa_error(...) ... }
>
> Improves performance in OglBatch7 (a CPU-bound microbenchmark) on
> an i7 4750HQ (Haswell) by 1.08546% +/- 0.519734% (n=292).
>
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>

Neat!

I think you're supposed to be able to get the same result by marking
_mesa_error as attribute cold.  Then nobody can forget to mark their
conditions as unlikely in the future.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150302/caf0aa48/attachment.sig>


More information about the mesa-dev mailing list