cfbolz changed the topic of #pypy to: PyPy, the flexible snake (IRC logs: https://quodlibet.duckdns.org/irc/pypy/latest.log.html#irc-end ) | use cffi for calling C | if a pep adds a mere 25-30 [C-API] functions or so, it's a drop in the ocean (cough) - Armin
<arigo>
rjarry: I *guess* you could redeclare the struct CDataObject in your own extension, and use that to access directly the "char *c_data" field of any CData object from C
<arigo>
that's a hack that is not portable, e.g. to PyPy
<rjarry>
ah, that's what I wondered :(
<arigo>
but for CPython it should be stable
<rjarry>
to PyPy the ABI is different but can I determine that when compiling the extension?
<arigo>
yes
<rjarry>
and access another offset in the structure
<arigo>
no :-/
<arigo>
on pypy there is nothing stable like that
<rjarry>
that's unfortunate
<arigo>
and anyway, on pypy it's going to be faster to not run CPython C API code at all
<rjarry>
hmm
<arigo>
so you could write an optional CPython C API extension for CPython only
<rjarry>
I could keep the pure python version for pypy yes
<rjarry>
I need to experiment a bit to see if it is worth the hassle
<rjarry>
and is that realistic to modify the char *c_data field of any CData object from C ?
<arigo>
no, it's supposed to be immutable
<rjarry>
ok, I give up then :)
<arigo>
really, if you're aiming for top performance on CPython, sometimes the best results are achieved by writing a plain CPython C extension---don't try to mix in cffi
<arigo>
unfortunately, that's slower on PyPy
<arigo>
with cffi you're supposed to get reasonable performance on CPython and top performance on PyPy
<arigo>
(which is supposed to be what people using CPython or PyPy are looking for)
<rjarry>
I understand
<rjarry>
I had thought trying out Cython, but that does not look like an easy solution either
oberstet has quit [*.net *.split]
[Arfrever] has quit [*.net *.split]
dansan has quit [*.net *.split]
ebarrett has quit [*.net *.split]
xcm has quit [*.net *.split]
[Arfrever] has joined #pypy
jacob22 has quit [Read error: Connection reset by peer]
dansan has joined #pypy
ebarrett has joined #pypy
oberstet has joined #pypy
jacob22 has joined #pypy
xcm has joined #pypy
<arigo>
right
<arigo>
for performance on both cpython and pypy, there's the upcoming "hpy" project, but it's not ready yet