Hi all,

I believe this problem has been brought to your attention before. But,
perhaps it something that can be added to the bug list.

I'm using a proprietary Windows library which unfortunately uses callbacks
a lot. I've attached a simple test case. Under pypy 1.7, this runs about 8
times slower than CPython 2.7.

Best, -arman
from ctypes import *
import timeit

def py_cmp_func(a, b):
    return a[0] - b[0]

CMPFUNC   = CFUNCTYPE(c_int, POINTER(c_int), POINTER(c_int))
cmp_func  = CMPFUNC(py_cmp_func)
int_size  = sizeof(c_int)
LEN       = 5
IntArray5 = c_int * LEN
ia        = IntArray5(5, 1, 7, 33, 99)
qsort     = cdll.msvcrt.qsort

def f():
    qsort(ia, LEN, int_size, cmp_func)

print timeit.repeat("f()", "from __main__ import f", number=100000)
_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
http://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to