[Mono-dev] Faster

Michael Hutchinson m.j.hutchinson at gmail.com
Thu Mar 24 17:47:41 EDT 2011


On Thu, Mar 24, 2011 at 12:51 PM, Rodrigo Kumpera <kumpera at gmail.com> wrote:
> Now onto the null check. Such a null check will exploit a cpu feature known
> as branch prediction, which guesses the outcome of the
> conditional jump. Since in the majority of the cases the value won't be
> null, the cpu can pretend the branch doesn't exist and keep executing
> as it was not taken. This means the null check costs virtually nothing on a
> modern cpu.

Could we have the JIT recognize the "if (foo == null) throw ..."
pattern and add a branch hint?

-- 
Michael Hutchinson
http://mjhutchinson.com


More information about the Mono-devel-list mailing list