|
|
Log in / Subscribe / Register

GUADEC: Luis Villa points GNOME at the web

GUADEC: Luis Villa points GNOME at the web

Posted Jul 30, 2010 0:41 UTC (Fri) by ras (subscriber, #33059)
In reply to: GUADEC: Luis Villa points GNOME at the web by elanthis
Parent article: GUADEC: Luis Villa points GNOME at the web

To think that Python is an answer because JavaScript is slow just proves you have abso-freaking-lutely no idea what you're talking about. Python is one of the slowest of all the popular interpreted languages out there by a good margin, and JavaScript implementations have easily taken the crown as being the fastest. Hell, even Ruby (once the absolute king of slow-and-stupid runtimes) is faster than Python these days.

Actually, Python is substantially faster than Ruby, Perl, PHP, and most JavaScript implementations for that matter. See:

The Computer Language Shootout

That said, there is one very fast JavaScript implementation out there - V8. Given the amount of time and effort being poured into JavaScript I expect it will be the fastest in the medium term. But not in the long term, primarily because Python and JavaScript are almost identical languages under the hood. The main difference is Python has a sane syntax, so you don't have to go looking for the good parts. Given V8 already runs 3 times faster than Python, I suspect the urge to apply the techniques used in V8 to Python will become irresistible.

If you are doubting that Python and JavaScript are very similar have a look at Pyjamas, a Python to JavaScript Compiler. Turns out there is almost a 1 to 1 correspondence between Python constructs and JavaScript.


to post comments

GUADEC: Luis Villa points GNOME at the web

Posted Aug 2, 2010 15:34 UTC (Mon) by nye (guest, #51576) [Link] (2 responses)

>The main difference is Python has a sane syntax, so you don't have to go looking for the good parts.

In your opinion. I find Python to be distressingly inelegant at times, and has enough gotchas to be mildly dangerous. Reasonable people can differ here.

>If you are doubting that Python and JavaScript are very similar have a look at Pyjamas, a Python to JavaScript Compiler. Turns out there is almost a 1 to 1 correspondence between Python constructs and JavaScript.

The conclusion doesn't necessarily follow from the premise. Python can be compiled to JavaScript pretty successfully, but I think the reverse would be harder (Python doesn't even have closures; how can you take a dynamic language seriously without closures? :p) - although as we all know, it is possible *in principle* to compile any (Turing complete) language into any other.

This probably doesn't change your point about speed, and it would be interesting to see if the same techniques can be successfully applied to speed up Python, but the fact that JavaScript is improving in that area faster than Python would be a warning sign.

GUADEC: Luis Villa points GNOME at the web

Posted Aug 2, 2010 22:49 UTC (Mon) by ras (subscriber, #33059) [Link] (1 responses)

Posted Aug 2, 2010 15:34 UTC (Mon) by nye (subscriber, #51576):

Python doesn't even have closures

Quoting from Wikipedia: Python has had support for lexical closures since version 2.2.

GUADEC: Luis Villa points GNOME at the web

Posted Aug 3, 2010 10:37 UTC (Tue) by nye (guest, #51576) [Link]

Thanks for the correction. Since I can't imagine the last time I looked was before 2.2, I can only assume that Python's weird scoping led me to the conclusion that closures were useless, and I misremembered that as 'absent'.

Many more thanks for introducing me to the 'nonlocal' keyword - finally a good reason to use Python 3.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds