On Tue, Mar 8, 2016 at 12:25 AM, BartC <b...@freeuk.com> wrote: > No, I only compare basic language functions. I understand that Python > depends on complex built-in functions, and external libraries such as numpy, > for it to be used viably. But I'm also interested in using such languages > directly. > > Take the jpeg benchmark. Of course both Python and my language are > hopelessly slow and impractical compared with a C implementation, but this > is still a useful test (and in fact the interpreted version was used to more > easily develop a streamlined decoder that was then back-ported to C, > doubling its speed). > > (The Python version of that program is here: > http://pastebin.com/cHx3UhQb. It should work with any Python.)
Actually, it won't work with any Python - not if it gets a broken file. Your abortjpeg() function doesn't work :) But what you have there is a messy mixture of old-style classes used as if they were C structs, array.array() as if it were a C array, and utterly uncommented code that looks like it was ported from, again, C. You're not going to prove anything useful about Python - any version of Python - by using it badly. Try implementing JPEG decoding in a more Pythonic way - or, better still, use pillow and don't write that kind of code yourself at all. Benchmarking Py2 vs Py3 on that kind of code is like trying to figure out whether it's easier to drag a 747 by your teeth or your toes. Yeah, you might get a result, but it's a useless one. ChrisA -- https://mail.python.org/mailman/listinfo/python-list