News for hackers. Stuff that matters.
Re:Modern Javascript: Everything you missed over the last 10... by SavantIdiot on Saturday May 15, 2021 @02:37PM (#27167737)
> computationally heavy parallel computing.

JS has no parallel computing support, so it is not an option. And when I say parallel computing, I don't mean distributed computing, I mean utilizing hundreds (thousands) of cores on a single die, like NVIDIA architectures. (It's a black art, even addition algorithms can confuse the newcomer.)

The best course is to do what every other language does when it comes to simple-parallel operations, like Gauss-Jordan elimination: use a dedicated, optimized library, like NumPY.

I really hope some day there will be a numpy for JS. NumJS is dead, and Google's TensorFlowJS is excellent for utilizing GPUs, but a dog when trying to do simple operations (the load/store async nature doesn't quite fit with most use cases.) I suspect WebAsm will facilitate the parallel nature of tensor operations without having to move

Re:Modern Javascript: Everything you missed over the last 10... by yashap on Saturday May 15, 2021 @07:30PM (#27169888)
Node does have worker threads. They’re awkward because no shared memory, lots of serialization overhead and boiler plate, but if you’ve got heavy data processing to do on say a 4-8 CPU machine, you can certainly split it up between 4-8 CPU threads.
Re:Modern Javascript: Everything you missed over the last 10... by SavantIdiot on Sunday May 16, 2021 @12:41PM (#27174871)
That's process parallelism, not compute parallelism. To radically different things.

I've avoided using node worker threads in favor child.fork, which then resolves to IPC through process.on and process.send, which is like any other process management.

Re:Modern Javascript: Everything you missed over the last 10... by hajile on Saturday May 15, 2021 @08:57PM (#27170303)
Node supports SharedArrayBuffer. It’s not perfect, but is usable.

In truth, assemblyscript or rust running in wasm is probably the best solution going forward.

Re:Modern Javascript: Everything you missed over the last 10... by yashap on Saturday May 15, 2021 @09:48PM (#27170533)
True, but regardless, the kind of ergonomic, low overhead parallel computing available in Scala or Go just isn’t possible in Node. In Scala or Go, parallel computing is barely anymore difficult than synchronous computing, in Node it’s quite the pain in the ass once you want to start passing objects with methods and whatnot between threads.
Re:Modern Javascript: Everything you missed over the last 10... by lhnz on Saturday May 15, 2021 @02:42PM (#27167783)
It sounds like you want something a bit like WebGPU: https://gpuweb.github.io/gpuweb/
Re:Modern Javascript: Everything you missed over the last 10... by SavantIdiot on Saturday May 15, 2021 @03:06PM (#27167950)
Close, but I don't want to have to switch memory models, e.g. upload/download. What I want is the incredibly diverse numerical computing support and logical syntax of NumPY but in the same process & memory space. The W3C endeavor is something a little different. Thanks tho!!
Re:Modern Javascript: Everything you missed over the last 10... by lhnz on Saturday May 15, 2021 @03:18PM (#27168041)
I think you will be interested to read this article about the future of data programming in JavaScript (http://benschmidt.org/post/2020-01-15/2020-01-15-webgpu/).

I do think that this kind of thing will be able to be built on top of WebGPU (I saw this experimental POC that did so recently: https://github.com/milhidaka/webgpu-blas). The only issue is that since JavaScript doesn't support operator overloading even if a production-level library was created the code would be a little less readable.

Re:Modern Javascript: Everything you missed over the last 10... by SavantIdiot on Sunday May 16, 2021 @11:14PM (#27179743)
This article nails it. While Python is such an elegant language for scientific research, it falls on its face when it comes to packaged applications (and as stated in my other posts, it's awkward async support compared to Node). I realllly hope scientific computing moves into NodeJS, or, Python gets better at asyncio and cross-platform packaging.