fix performance hit in argument unpacking when passing keyword arguments into functio...
authorStefan Behnel <scoder@users.berlios.de>
Wed, 28 Jul 2010 07:50:38 +0000 (09:50 +0200)
committerStefan Behnel <scoder@users.berlios.de>
Wed, 28 Jul 2010 07:50:38 +0000 (09:50 +0200)
Cython/Compiler/Nodes.py

index 03b593fdca6342bd094d55d4be297ef4d03fa97e..6069072ca37acf50d7905c2a36d1c063dcac8663 100644 (file)
@@ -2647,10 +2647,10 @@ class DefNode(FuncDefNode):
                     if arg.kw_only:
                         # handled separately below
                         continue
-                    code.putln('if (kw_args > %d) {' % num_required_args)
+                    code.putln('if (kw_args > 0) {')
                     code.putln('PyObject* value = PyDict_GetItem(%s, %s);' % (
                         Naming.kwds_cname, pystring_cname))
-                    code.putln('if (unlikely(value)) { values[%d] = value; kw_args--; }' % i)
+                    code.putln('if (value) { values[%d] = value; kw_args--; }' % i)
                     code.putln('}')
                 else:
                     num_required_args -= 1