[pypy-issue] [issue1237] pypy 2x slower than python on ctypes.Structure

viblo tracker at bugs.pypy.org
Sat Aug 18 19:21:38 CEST 2012

New submission from viblo <pypy at viblo.se>:

The attached code runs about 2x slower on pypy than cpython. It contains (part
of) a 2d Vector class, Vec2d, and small loop that uses it to do some
calculations. Vec2d inherits ctypes.Structure to be usable into a wrapped c
library using ctypes and it is this part that seems to be slow. If I skip
inheriting ctypes.Structure everything is speedy.

The code is part of the pymunk library (http://code.google.com/p/pymunk/) and
while I investigated the performance of pymunk in pypy I found this problem. I
think the attached code showcase a typical use case even if its very minimized
for this report.

files: vec2d_bench.py
messages: 4655
nosy: pypy-issue, viblo
priority: performance bug
release: 1.9
status: unread
title: pypy 2x slower than python on ctypes.Structure

PyPy bug tracker <tracker at bugs.pypy.org>

More information about the pypy-issue mailing list