[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Using __builtin_expect (likely/unlikely macros)
From: |
Alex Gramiak |
Subject: |
Using __builtin_expect (likely/unlikely macros) |
Date: |
Sun, 14 Apr 2019 18:15:44 -0600 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) |
Would using these, if available, be acceptable? I noticed that some code
in configure.ac already defines HAVE___BUILTIN_EXPECT, though I couldn't
see what part of autoconf does this.
Good candidates here include the conditionals around emacs_abort/fatal,
and possibly in cases like the *alloc procedures and xfree.
Even if there's no noticeable speedup, I think that the likely/unlikely
macros are a nice way to indicate that a branch is exceedingly
rare/common.
#define unlikely(expr) __builtin_expect(!!(expr), 0)
#define likely(expr) __builtin_expect(!!(expr), 1)
- Using __builtin_expect (likely/unlikely macros),
Alex Gramiak <=
- Re: Using __builtin_expect (likely/unlikely macros), Paul Eggert, 2019/04/14
- Re: Using __builtin_expect (likely/unlikely macros), Alex Gramiak, 2019/04/14
- Re: Using __builtin_expect (likely/unlikely macros), Paul Eggert, 2019/04/15
- Re: Using __builtin_expect (likely/unlikely macros), Alex Gramiak, 2019/04/15
- Re: Using __builtin_expect (likely/unlikely macros), Eli Zaretskii, 2019/04/15
- Re: Using __builtin_expect (likely/unlikely macros), Alex Gramiak, 2019/04/16
- Re: Using __builtin_expect (likely/unlikely macros), Eli Zaretskii, 2019/04/16
- Re: Using __builtin_expect (likely/unlikely macros), Alex Gramiak, 2019/04/16
- Re: Using __builtin_expect (likely/unlikely macros), Paul Eggert, 2019/04/15
- Re: Using __builtin_expect (likely/unlikely macros), Stefan Monnier, 2019/04/16