[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-libjit] performance of conditionals
From: |
Paul Brannan |
Subject: |
[Dotgnu-libjit] performance of conditionals |
Date: |
Mon, 10 Nov 2008 10:30:45 -0500 |
User-agent: |
Mutt/1.5.18 (2008-08-26) |
I have a conditional in which one case is many more times likely to
occur than the other case. Currently the implementation does this:
branch_if_not(cond, L1)
<true case>
branch(L2)
L1: <false case>
L2: <remainder of code>
...
return
I have considered implementing it like this instead:
branch_if_not(cond, L1)
<true case>
L2: <remainder of code>
...
return
L1: <false case>
branch(L2)
thus avoiding the branch for the usual case.
I'm not a low-level guru, so I'm curious how in general this sort of
refactoring affects performance.
I would write a benchmark, but I'm not sure how to write it in such a
way that it would necessarily reflect real-world performance.
Thoughts?
Paul
- [Dotgnu-libjit] performance of conditionals,
Paul Brannan <=