[pypy-dev] Should jitviewer come with a warning?

Maciej Fijalkowski fijall at gmail.com
Sun Feb 3 21:50:57 CET 2013


On Sun, Feb 3, 2013 at 10:29 PM, John Camara <john.m.camara at gmail.com> wrote:
>> Also, looking at the msgpack - this code is maybe not ideal, but if
>> you're dealing with buffer-level protocols, you end up with code
>> looking like C a lot.
>
> I do agree that this type a code will likely end up looking like C but it's
> not necessary for all of it to look like c.  Like there should be a need to
> have long chains of if, elif statements.  Using pack_into and unpack_from
> instead of pack and unpack methods so that it directly deals with the buffer
> instead of making sub strings.  Even if pypy can optimize this away why
> write Python code like this when its not necessary.

er. strings are immutable in python. you can unpack into them. other
kinds of buffers are kind of dodgy, because python never grew a
correct buffer.

>
> Plus I felt, initially the code should just use cffi and connect to the
> native c library.  I believe this approach is likely to give very close to
> the best performance you could get on pypy for this type of library.  I'm
> not sure how much of an increase in performance would be gain by writing the
> library completely in Python vs using cffi.  Is there anything wrong with
> this line of thinking.  Do you feel a pure Python approach could achieve
> better results than using cffi under pypy.

python is nicer. It does not segfault. Besides, how do you get a
string out of a C library? if you do raw malloc it's prone to be bad.
Etc. etc.

>
> John
>
> _______________________________________________
> pypy-dev mailing list
> pypy-dev at python.org
> http://mail.python.org/mailman/listinfo/pypy-dev
>


More information about the pypy-dev mailing list