News for hackers. Stuff that matters.
Re:Migrated WordGap from Python to Go 1 by coldtea on Saturday March 23, 2013 @05:45PM (#5429904)
>Such difference is not impossible between languages

Not only it's not impossible, but it's also quite common, even for programs having the same program-level algorithmic complexity.

Except if the programs are IO bound (which happens with most of them), you can see real differences between various languages. It doesn't even have to be compiled vs interpreted (well, if you exclude JITs). A V8 JS program can smoke a Python program (when the latter doesn't reach for some C builtin function).

Re:Migrated WordGap from Python to Go 1 by pekk on Saturday March 23, 2013 @06:10PM (#5429989)
Of course, a Python program can also smoke a V8 JS program, this happens too. And it is not realistic to compare Python to JS while excluding any commonly used optimization strategy for the former, whether that be C or PyPy or using different language constructs.
Re:Migrated WordGap from Python to Go 1 by kkowalczyk on Saturday March 23, 2013 @06:59PM (#5430162)
Neither C nor PyPy is "commonly used optimization strategy" so the comparison is very much correct.

People reach for C when they are desperate for performance, have the skills to do C, have the time to do C and are ok with loosing the cross-platform capabilities. Pure python code runs on mac/windows/unix (90% of the time). The moment you add a C module to the mix, you end up with the usual cross-platform mess (separate installers for each platform, complicated build processes etc.).

Re:Migrated WordGap from Python to Go 1 by icebraining on Saturday March 23, 2013 @08:01PM (#5430401)
Reaching for C doesn't have to mean writing C; it can just be using a different library and adapting your code to call it.
Re:Migrated WordGap from Python to Go 1 by coldtea on Sunday March 24, 2013 @03:22PM (#5433161)
>Of course, a Python program can also smoke a V8 JS program, this happens too.

A cleverly written Python program can indeed beat a naively written V8/JS program.

But if they have the same program-level complexity and the Python program doesn't delegate to C libraries, V8 wins. That is: when using the same algorithms in both languages, V8 is faster.

We have h264 decoders using Javascript, and even ports of the QT widget stuck into pure JS (using emscripten). And they run in acceptable speed. Those would be hopeless in pure Python without adding new ad-hoc C extensions.

>And it is not realistic to compare Python to JS while excluding any commonly used optimization strategy for the former, whether that be C or PyPy or using different language constructs.

Well, it's fair, in the sense that mainstream JS is fast, whereas mainstream Python (CPython) is not. And you don't have to resort to stuff like Cython, SWIG and such with JS to get that performance.