[Top][All Lists]

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

Re: Using branch prediction hints (or not)

From: Neil Jerram
Subject: Re: Using branch prediction hints (or not)
Date: Tue, 04 Dec 2007 22:36:45 +0000
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux)

address@hidden (Ludovic Courtès) writes:

> I played with GCC's `__builtin_expect' (patch attached) to provide GCC
> with branch prediction hints in the most obvious situations:
> `SCM_ASSERT'-like macros, `scm_wrong_num_args ()' situations in the
> evaluator, and a few others.
> It provides a little improvement on my x86 machine, less than 5% for
> this program:
>   (let loop ((x 20000000))
>     (and (> x 0)
>          (loop (1- x))))
> This made me wonder whether it's even worth it.  OTOH, it doesn't hurt.
> So, should we apply it?

Sounds like 5% worth having to me.

In terms of code readability (and so maintainability), I'd say the
SCM_EXPECT_XXX forms fit in quite easily, and don't make the code
noticeably more confusing or difficult.

So I'm in favour.


reply via email to

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