[pypy-commit] pypy default: add comment

arigo noreply at buildbot.pypy.org
Thu Jan 22 13:37:57 CET 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r75482:cfeb96967bad
Date: 2015-01-22 13:37 +0100
http://bitbucket.org/pypy/pypy/changeset/cfeb96967bad/

Log:	add comment

diff --git a/rpython/rtyper/lltypesystem/rordereddict.py b/rpython/rtyper/lltypesystem/rordereddict.py
--- a/rpython/rtyper/lltypesystem/rordereddict.py
+++ b/rpython/rtyper/lltypesystem/rordereddict.py
@@ -46,6 +46,10 @@
 @jit.oopspec('ordereddict.lookup(d, key, hash, flag)')
 def ll_call_lookup_function(d, key, hash, flag):
     fun = d.lookup_function_no & FUNC_MASK
+    # This likely() here forces gcc to compile the check for fun == FUNC_BYTE
+    # first.  Otherwise, this is a regular switch and gcc (at least 4.7)
+    # compiles this as a series of checks, with the FUNC_BYTE case last.
+    # It sounds minor, but it is worth 6-7% on a PyPy microbenchmark.
     if likely(fun == FUNC_BYTE):
         return ll_dict_lookup(d, key, hash, flag, TYPE_BYTE)
     elif fun == FUNC_SHORT:


More information about the pypy-commit mailing list