• Tim Peters's avatar
    docompare(): Use PyTuple_New instead of Py_BuildValue to build compare's · f2a04733
    Tim Peters yazdı
    arg tuple.  This was suggested on c.l.py but afraid I can't find the msg
    again for proper attribution.  For
    
        list.sort(cmp)
    
    where list is a list of random ints, and cmp is __builtin__.cmp, this
    yields an overall 50-60% speedup on my Win2K box.  Of course this is a
    best case, because the overhead of calling cmp relative to the cost of
    actually comparing two ints is at an extreme.  Nevertheless it's huge
    bang for the buck.  An additionak 20-30% can be bought by making the arg
    tuple an immortal static (avoiding all but "the first" PyTuple_New), but
    that's tricky to make correct since docompare needs to be reentrant.  So
    this picks the cherry and leaves the pits for Fred <wink>.
    
    Note that this makes no difference to the
    
        list.sort()
    
    case; an arg tuple gets built only if the user specifies an explicit
    sort function.
    f2a04733
Adı
Son kayıt (commit)
Son güncelleme
Demo Loading commit data...
Doc Loading commit data...
Grammar Loading commit data...
Include Loading commit data...
Lib Loading commit data...
Mac Loading commit data...
Misc Loading commit data...
Modules Loading commit data...
Objects Loading commit data...
PC Loading commit data...
PCbuild Loading commit data...
Parser Loading commit data...
Python Loading commit data...
RISCOS Loading commit data...
Tools Loading commit data...
.cvsignore Loading commit data...
.hgtags Loading commit data...
LICENSE Loading commit data...
Makefile.pre.in Loading commit data...
PLAN.txt Loading commit data...
README Loading commit data...
configure Loading commit data...
configure.in Loading commit data...
install-sh Loading commit data...
pyconfig.h.in Loading commit data...
setup.py Loading commit data...