Hi,

I've found a small example where PyPy is a *lot* slower (more than 4x) than CPython. The example calculates all the possible groupings of a list of values:

---/---
def allgroup(expansions, n=0, groups = []):
    expgroup = [expansions[n]]
    if n == len(expansions) - 1:
        yield groups + [expgroup]
        for i in xrange(len(groups)):
            tmp = groups[i]
            groups[i] = tmp + expgroup
            yield groups
            groups[i] = tmp
    else:
        for g in allgroup(expansions, n+1, groups + [expgroup]):
            yield g
        for i in xrange(len(groups)):
            tmp = groups[i]
            groups[i] = tmp + expgroup
            for g in allgroup(expansions, n + 1, groups):
                yield g
            groups[i] = tmp

count = 0
for i in allgroup(range(13)):
    count += 1
print count
---/---

time python allgroups.py
        20.75s user 0.04s system 99% cpu 20.820 total

time pypy allgroups.py
        97.31s user 1.07s system 99% cpu 1:38.55 total

Regards,

l.
_______________________________________________
pypy-dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to