Live data from Hacker News

The fastest Statistical Programming Language is …Javascript?

r-bloggers.com

31–40 of 41 posts

Re: The fastest Statistical Programming Language is …Javascript?

#31
post #7

Earlier quoted context omitted.

or there is no dedicated library for matrix multiplication compared to the other languages..

More to the point - who cares. All these languages are hopelessly slow. If performance matters do it in a performant language like C++, C or FORTRAN. If it does not matter - then it does not matter and so stop going on about it.

No, it does matter. A lot of scientific computation is one-time-use code. What one cares about is the amount of time to write, execute, and debug the code. If it will take you much less time to write the code in a high-level language (which is usually the reason people use high-level languages), it may very well be worth the 2x performance hit from Julia, or even the larger performance hits of MATLAB and R. Additionally, when the amount of time spent performing vector and matrix operations greatly exceeds the amount of time spent in the interpreter, most of these languages will be as fast as C.

I write MATLAB code that takes 5 minutes to run on a regular basis. If I were to write it in C, I would lose productivity, because it would take much more than 5 minutes longer to write. If I were to write it in Julia, it would probably take about the same amount of time to write, but I would hypothetically have the results in a few seconds. That matters.

Re: The fastest Statistical Programming Language is …Javascript?

#32

Urrgh. This came through on my feed earlier today, and I left a comment on it. While javascript is fast (and can be used for many things), the real issue with using it for stats is the lack of libraries. More specifically, as far as I know it cannot interface with Fortran. That's a death knell for any statistical programming language, as it means no LAPACK, and no-one (sane) is going to rewrite all of those linear al…

any opinion about F#/Mono which seemingly does have blas/lapack support ?

Re: The fastest Statistical Programming Language is …Javascript?

#33

His table shows js is 40x slower on matrix multiplication.

If you look at the code it's not using WebWorkers. It's pretty unfair to compare single threaded vs multithreaded. I don't know how JS would perform with better code but it'd certainly be better than 40x slower.

Re: The fastest Statistical Programming Language is …Javascript?

#34

Earlier quoted context omitted.

Ergo, JavaScript isn't the fasted language for that matters, because matrix multiplication is too important.

It's not just that. It's that there's no concept of a vector or matrix at all, and no operator overloading to allow these concepts to be introduced into the language in an idiomatic way. You could put these things into a bastardized JavaScript JIT, but that seems at least as awkward as Julia.

http://coffeescript.org/ has demonstrated how to fix that problem.

If the underlying engine is fast, a more convenient syntax can be introduced.

Re: The fastest Statistical Programming Language is …Javascript?

#35
post #21

What about straight C??? There are many great stats libraries in C (e.g. Apophenia). C is not a hipster language but maybe (like polaroid filters in Instagram) it's time for it to make a "retro" comeback. C kicks ass for speed. Obviously.

I'm waiting for somebody to make a CoffeeScript for C. No semicolons, comprehensions, syntactic sugar for function pointers, etc.

Re: The fastest Statistical Programming Language is …Javascript?

#36

Urrgh. This came through on my feed earlier today, and I left a comment on it. While javascript is fast (and can be used for many things), the real issue with using it for stats is the lack of libraries. More specifically, as far as I know it cannot interface with Fortran. That's a death knell for any statistical programming language, as it means no LAPACK, and no-one (sane) is going to rewrite all of those linear al…

> no-one (sane) is going to rewrite all of those linear algebra libraries Is it because it would take a long time or because it's inherently hard?

There are a lot of them, they're all very picky, detailed inner loops, and they're already written and highly tested and optimized. People rewrite it all the time just to find that their versions are incomplete, slow, and buggy and nobody who wants to use LAPACK has patience for any of those three things.

Re: The fastest Statistical Programming Language is …Javascript?

#37

Urrgh. This came through on my feed earlier today, and I left a comment on it. While javascript is fast (and can be used for many things), the real issue with using it for stats is the lack of libraries. More specifically, as far as I know it cannot interface with Fortran. That's a death knell for any statistical programming language, as it means no LAPACK, and no-one (sane) is going to rewrite all of those linear al…

So regardless of how fast it is, its not going to make it as a stats language

Why do you assume that JS can never be integrated with LAPACK etc.? That's hardly impossible.

Re: The fastest Statistical Programming Language is …Javascript?

#38
post #34

Earlier quoted context omitted.

It's not just that. It's that there's no concept of a vector or matrix at all, and no operator overloading to allow these concepts to be introduced into the language in an idiomatic way. You could put these things into a bastardized JavaScript JIT, but that seems at least as awkward as Julia.

http://coffeescript.org/ has demonstrated how to fix that problem. If the underlying engine is fast, a more convenient syntax can be introduced.

I thought about this a little bit, and I don't think this would be very trivial. CoffeeScript is designed to map easily onto JavaScript. A transcompiler that compiles JavaScript with matrix extensions to performant plain JavaScript would likely be significantly more complex than the CoffeeScript transcompiler.

Consider that you want to translate the matrix operation A * B into A.times(B). You have two options:

1) Figure out what's a matrix before runtime, using static type inference. 2) Translate the code into JavaScript that determines whether to treat the code as a matrix at runtime.

In the first case, you don't need a JIT at all. JITs exist largely because you can't do perfect type inference in dynamic languages. If you can do perfect type inference on all acceptable code (a la RPython), or if you require type annotations, you can compile straight to C or machine code.

In the second case, you take a speed hit of 25-50% on scalar operations for the guard, at least in modern versions of SpiderMonkey and V8 (see http://jsperf.com/cost-of-multiplication-via-function).

You can probably get acceptable performance out of combining static type inference with guards. My understanding is that this is what SpiderMonkey does internally. But at this point, it might be easier to integrate your functionality into an existing JIT than to write your transcompiler with type inference, particularly since you will have to implement matrix and vector ops inside the JS engine to achieve acceptable performance anyway.

Re: The fastest Statistical Programming Language is …Javascript?

#39
Does performance really matters? I rather have richer libraries (like R has) than performance, since it's impossible to plot for example, all your Apache logs or any other big data problem, you just need a subset of the data and plot them, and with that you don't need a super fast language.

Re: The fastest Statistical Programming Language is …Javascript?

#40
post #21

What about straight C??? There are many great stats libraries in C (e.g. Apophenia). C is not a hipster language but maybe (like polaroid filters in Instagram) it's time for it to make a "retro" comeback. C kicks ass for speed. Obviously.

I'm waiting for somebody to make a CoffeeScript for C. No semicolons, comprehensions, syntactic sugar for function pointers, etc.

http://golang.org/
Post reply on HN