Filip Gruszczyński <grusz...@gmail.com> added the comment: Here are some example performance results:
def cmp(x, y): return y - x sorted(range(1, 10000000), key=cmp_to_key(cmp)) ''' C version: real 0m19.994s user 0m8.053s sys 0m1.044s Python version: real 0m28.825s user 0m28.046s sys 0m0.728s ''' def cmp(x, y): x = int(x) y = int(y) return (x > y) - (y > x) sorted([str(i) for i in reversed(range(1, 2000000))], key=cmp_to_key(cmp)) ''' Python version real 0m15.930s user 0m15.629s sys 0m0.284s C version real 0m10.880s user 0m10.585s sys 0m0.284s ''' There is some performance gain. I don't know however, if it's enough to use C version instead of Python, that's for Raymond to decide. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue11707> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com