[1] https://github.com/fabric-engine/Benchmarks/blob/f11cf6cc8cf... [2] https://github.com/fabric-engine/Benchmarks/blob/f11cf6cc8cf...
Nodejs+Fabric as fast as multi-threaded C++
11–20 of 68 posts
Re: Nodejs+Fabric as fast as multi-threaded C++
#12Not that it diminishes the interestingness of this post (quite the opposite), but it's worth noting that this is not achieved using plain-vanilla JavaScript. From the product page: "The high-performance parts of the application are written using a performance-specific extension to JavaScript, called KL (Kernel Language). This language is similar in scope and syntax to JavaScript, but has some key differences that opt…
In other words, a better headline would be "Fabric Engine fast as multithreaded C++ (and can be glued to JS)"
Given the code used, it looks like it might be straightforward to use openmp rather than pthreads. I'd be interested in seeing how that works out.
Re: Nodejs+Fabric as fast as multi-threaded C++
#13So this software involves installing a plugin in the browser? In an age where users are being warned by the browser makers themselves to be careful about that sort of thing? I can't see this ending well.
But yes, they do have a plugin version of Fabric. I have similar misgivings about that.
Re: Nodejs+Fabric as fast as multi-threaded C++
#14Also, what floating point type is KL using? float or double? - and is double necessary? - converting the C++ code to use floats would probably provide a fair speedup on the divides and due to squeezing more data into cache lines...
Re: Nodejs+Fabric as fast as multi-threaded C++
#15The C++ versions were compiled using gcc version 4.4.5 using the compiler flags “-O6 – lpthread”. Isn't -O6 the same as -O3 ?
Re: Nodejs+Fabric as fast as multi-threaded C++
#16I wouldn't call that code C++ at all, it's C with a few C++ keywords/niceties. [1],[2] [1] https://github.com/fabric-engine/Benchmarks/blob/f11cf6cc8cf... [2] https://github.com/fabric-engine/Benchmarks/blob/f11cf6cc8cf...
On my machine the C and C++ versions essentially have the same speed.
Re: Nodejs+Fabric as fast as multi-threaded C++
#17Could probably squeeze a bit more out of the C++ version by targeting the specific architecture of the CPU to make use of SSE. Also, what floating point type is KL using? float or double? - and is double necessary? - converting the C++ code to use floats would probably provide a fair speedup on the divides and due to squeezing more data into cache lines...
Not only that, from browsing the code, the critical loop is likely matrix multiplication. If that's the case, any kind of engine who is smart about SSE, cache lines, etc is going to be able to outperform simple C/C++ code.
Of course there's excellent matrix maths libraries for C/C++ that could be used instead.
Re: Nodejs+Fabric as fast as multi-threaded C++
#18Not that it diminishes the interestingness of this post (quite the opposite), but it's worth noting that this is not achieved using plain-vanilla JavaScript. From the product page: "The high-performance parts of the application are written using a performance-specific extension to JavaScript, called KL (Kernel Language). This language is similar in scope and syntax to JavaScript, but has some key differences that opt…
It's not so much "java script is as fast as C++", but "our system is a fast as C++ and you can use it from java script". They are using "Node.js" and "JavaScript" in title for the marketing angle if anything, because people don't use Node.js and JavaScript if they are trying to make parallel data processing programs.
Re: Nodejs+Fabric as fast as multi-threaded C++
#19Could probably squeeze a bit more out of the C++ version by targeting the specific architecture of the CPU to make use of SSE. Also, what floating point type is KL using? float or double? - and is double necessary? - converting the C++ code to use floats would probably provide a fair speedup on the divides and due to squeezing more data into cache lines...
Using: -O3 -march=corei7 -msse -msse2 -msse3 -msse4 -fipa-matrix-reorg -fwhole-program
made negligible (if any) difference running var-mt:
Original: 30.464 30.211 30.646
with g++ options: 30.381 30.487 30.277
However, using ICC 12.0.4 (-o3 -xssse3) 25.418 25.613 25.392
On the same machine (SB 2.2Ghz).
Re: Nodejs+Fabric as fast as multi-threaded C++
#20Not that it diminishes the interestingness of this post (quite the opposite), but it's worth noting that this is not achieved using plain-vanilla JavaScript. From the product page: "The high-performance parts of the application are written using a performance-specific extension to JavaScript, called KL (Kernel Language). This language is similar in scope and syntax to JavaScript, but has some key differences that opt…
The other blog post that appeared on HN this week sums it out [1].
For those who didn't read that post, basically, if you want the performance of C, you have to make those data as static and inflexible, i.e. use types and avoid indirection. Looking at the KL used in benchmark, you may find that it resembles C code. It's exactly what they did to make it fast: types and free from indirection.
[1]: http://blog.mrale.ph/post/12396216081/the-trap-of-the-perfor...
[2]: https://github.com/fabric-engine/Benchmarks/blob/master/Serv...