[pypy-dev] offtopic, ontopic, ... (was: ctypes - PyPy 1.8 slower than Python 2.6.5)

Maciej Fijalkowski fijall at gmail.com
Mon Feb 13 21:41:27 CET 2012


On Mon, Feb 13, 2012 at 9:37 PM, Stefan Behnel <stefan_ml at behnel.de> wrote:
> Maciej Fijalkowski, 13.02.2012 19:44:
>> On Mon, Feb 13, 2012 at 4:29 PM, Stefan Behnel wrote:
>>> Sébastien Volle, 13.02.2012 13:33:
>>>> My team is working on a project of fast packet sniffers and I'm comparing
>>>> performance between different languages.
>>>> So, we came up with a simple ARP sniffer that I ported to Python using
>>>> ctypes.
>>>
>>> If performance is important to you, you may want to write the wrapper for
>>> Python in Cython instead (and maybe also parts of the filtering code, which
>>> I assume your program to be about).
>>
>> I appreciate your willingness to advertise cython wherever it's
>> possible, but this is simply not on topic on the current thread.
>
> Sébastien Volle replied to my mail telling me that their current approach
> was actually based on LuaJIT and its native FFI, and that he was mostly
> comparing that to other languages (which all loose thoroughly in the
> competition, BTW). That makes Cython on-topic for him at least.
>
> I also find Cython generally *very* on-topic when the intention is to
> interface Python code with C code, especially when performance and/or ease
> of use are part of the requirements. In terms of features and comfort,
> ctypes is still a bit too far behind the user experience that Cython has to
> offer. Given how important Cython has become for the Python ecosystem in
> many regards, it's sad that PyPy still doesn't have it available. From what
> I hear, that's a serious blocker to some users. (Or should I say "most users"?)

Fair point actually. And I agree about all points about ctypes.

>
>
>> Cython is not a panacea for all woes
>
> Well, what is?
>
>
>> and it's actually slower than
>> pypy on most cases that don't involve calling C. It's also slower even
>> when you provide direct type annotations
>
> Ah, "most cases", hm? How is that for a well founded statement? What are
> you using for comparison? speed.pypy.org? Have you noticed that amongst all
> those benchmarks there that PyPy was specifically tuned for, there is not a
> single benchmark that was selected specifically for Cython? There are
> always lies, damn lies and then there are benchmarks, don't forget that.

Well, those benchmarks were not really selected for pypy. There is a
very limited set of available interesting python benchmarks and we
made the selection rather on "what is slow" rather than "what is
fast", if any sort of pypy-related things were considered, barring the
obvious "does it run on PyPy".

>
>
>> so you have a pretty
>> reasonable usecase for pypy even in cases where calling C is a
>> problem. Also, we're going to attack those ctypes problems.
>
> Since when is "we can do that, too" synonymous with "there are no
> alternatives"? World domination seems an attractive goal to go after, but
> it's pretty boring in the long run.
>
> Besides, "going to attack" admits that you're not there yet. Cython has
> been there for a couple of years now, it solves real problems that real
> users have today, and it's constantly getting better in doing so, because
> it's being designed and developed to solve those problems.
>
> It may not be obvious to you, but PyPy isn't a panacea either.
>

Right. I agree that cython offers a much better experience than ctypes.

>
>> If you wish to respond to my mail, please put it into a post that has
>> a different title and not hijack all the discussions with cython.
>
> Ok, done. BTW, what are those show-off mails meant for that you keep
> sending to python-dev on each PyPy release? Do you really consider them
> on-topic for the development of the CPython runtime, or even just the
> Python language? Food for thought ...

Hm. I dunno, that might be really a mistake on our side. I'll probably
stick with python announce then.

PS. Sorry for the tone of my original email, it was a bit unprofessional.

Cheers,
fijal


More information about the pypy-dev mailing list