[pypy-issue] [issue1356] Casting a str into a ctype pointer fails

Vincent Pelletier tracker at bugs.pypy.org
Mon Jan 7 21:50:55 CET 2013


Vincent Pelletier <plr.vincent at gmail.com> added the comment:

...and I forgot to include pypy bench results for unpack-based code:

$ ~/hg/pypy/pypy/translator/goal/pypy-c -mtimeit -s "from ctypes import cast, c_ushort, POINTER; c_ushort_p = 
POINTER(c_ushort); from struct import unpack; from cStringIO import StringIO; data = '\x23\x01' * 1000" "read = 
StringIO(data).read" "for _ in xrange(len(data) / 2): unpack('<H', read(2))"
1000000 loops, best of 3: 1.94 usec per loop

"read = StringIO(data).read" accounting for 0.00114 usec per loop

I ran this on ~2 days ago hg, "default" branch. I'm rebuilding latest (?) and will re-post if results differ.
I'm not used to hg, is this the proper way to tell which commit is the top of current branch (this is what I'm building) 
?
$ hg log -r .
changeset:   59850:832cba6f5385
user:        mattip <matti.picus at gmail.com>
date:        Sun Dec 30 16:42:36 2012 +0200
summary:     move call to make_cmdline_overview so that readthedocs can find it

________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue1356>
________________________________________


More information about the pypy-issue mailing list