5 ms·
I don't know why trying to reach real-time speeds with Python. At the moment it's really a slow language. According to my measurements is JavaScript at the mome
by acqq 16y ago
I don't know why trying to reach real-time speeds with Python. At the moment it's really a slow language. According to my measurements is JavaScript at the moment the fastest "typeless" scripting language: the engine in Firefox can be up to 200 times faster than Python. There's also a command-line version.
- judofyr 16y agoWell, the fastest scripting language must be LuaJIT?
- acqq 16y agoIf you refer to http://shootout.alioth.debian.org/u32/luajit.php http://shootout.alioth.debian.org/u32/luajit.php my answer is: maybe. As far as I understand the JavaScript benchmarks there were made before the most recent speed improvements (JaegerMonkey, present in Firefox 4 beta). In my simple tests, the speed in some loops can reach the speed of C, with the times better than LuaJIT. Still, LuaJIT is easier to obtain and run, as far as I know.
- igouy 16y agoYou can help by providing clear instructions on how to build the latest JavaScript engine.
- acqq 16y agoI'd also like to know. At the time as first JIT functioned in the browser I wasn't able to download the sources which really did JIT on Linux in the command line. I wouldn't be surprised that now again the latest speedup in the browser is not repeatable in the command line for most of the people.
- igouy 16y agoDownloaded, installed and re-measured today. http://shootout.alioth.debian.org/u32/benchmark.php?test=all&lang=tracemonkey&lang2=luajit http://shootout.alioth.debian.org/u32/benchmark.php?test=all...
- acqq 16y agoThanks! LuaJIT really rules in the shootout. The tests I've done were only inside of Firefox 4 Beta and I've got 3.4 sec for 5M n-body on my slightly (30%) faster computer. I remember that traditionally the standalone builds of Mozilla JS were not giving the same results as the one in the browser. A message for Mozilla devs, in case anybody reads: be aware that people do try to measure how fast JS is from the command line and let them get the really last results! And use http://shootout.alioth.debian.org http://shootout.alioth.debian.org if you want to fundamentally improve your implementation of JS.
- igouy 16y agoNote the main n-body measurement is N=50,000,000. The source code was downloaded from the tracemonkey branch https://wiki.mozilla.org/JavaScript:New_to_SpiderMonkey https://wiki.mozilla.org/JavaScript:New_to_SpiderMonkey. They can do better than use the benchmarks game - Kraken is one attempt they are making to do better. http://krakenbenchmark.mozilla.com/index.html http://krakenbenchmark.mozilla.com/index.html
- acqq 16y agoRegarding sources, I know this: http://news.ycombinator.com/item?id=1754881 http://news.ycombinator.com/item?id=1754881 The benefits of the benchmarks game: allows comparison with other languages (like Lua) whereas as far as I understand their Kraken is JS only and browser only. Thanks a lot for your good work!
- cdavid 16y agoBut javascript does not have something like numpy. You can easily get one to two orders of magnitude faster using numpy when applicable, and a MP3 decode certainly falls in that category.
- pcwalton 16y agoFlusspferd (http://flusspferd.org/ http://flusspferd.org/) has GMP bindings, and there's no reason that node.js (for example) couldn't be hooked up to GMP as well.
- acqq 16y agoIt's true that Numpy is much faster. I believe there's a lot of native code in Numpy and once we consider the libraries encoded in C, any language can be as fast as any other, as soon as we can offload enough to the libraries (for example, Perl has also some official C extension mechanisms: http://perldoc.perl.org/h2xs.html http://perldoc.perl.org/h2xs.html and even old Visual Basic was able to call DLL's written in C). However, I'd really like if at least something that's now a part of Numpy (which I believe is now even more a language extension than a library) would become the part of the Python language.
- cdavid 16y agoNumpy does have a lot of C code compared to most python packages, but I don't think that's the right way to look at it. If numpy was only about something being in C instead of python, it would not be that interesting. But numpy brings you abstractions on top of python which are useful and even more high level than python, and that's what is interesting: abstractions which do make your code faster (when applicable, of course). From the blog's profiling posts, a lot of time seems to be spent into MDCT and polyphase decoding: both could be coded quite efficiently in numpy (I hope to add MDCT itself in scipy, actually). About being part of python: I don't think it would be a right move (and has been given up from both python and numpy), because numpy is quite big, and depends on quite hairy dependencies if you care about speed. I don't think it is fair to say that numpy is a language extension - numpy feels more natural than say twisted from a python integration POV. But I am a numpy developer, so maybe not the best judge.