Oh, man, can't wait to send it to the UI team who write dead slow React apps. JS is blazing fast. Especially if written well.
Show HN: Simulating 20M Particles in JavaScript
41–50 of 73 posts
Re: Show HN: Simulating 20M Particles in JavaScript
#42Re: Show HN: Simulating 20M Particles in JavaScript
#43Anyone else having trouble with that web vscode he's using?
Re: Show HN: Simulating 20M Particles in JavaScript
#44Re: Show HN: Simulating 20M Particles in JavaScript
#45Oh, man, can't wait to send it to the UI team who write dead slow React apps. JS is blazing fast. Especially if written well.
The problem is that idiomatic JS and blazing fast JS are diametrically opposed to each other, in practice the latter is more like a bad C dialect. You're not allowed to allocate GC objects in fast JS but the language doesn't have good non-allocating alternatives. Nobody is actually going to make a complex JS app where all memory allocations are pointers into a giant ArrayBuffer, it's easier to just switch to WebAssem…
However, that's not where the problem starts. A lot of web sites are slow because they simply run too much code that doesn't need running in the first place and allocates objects that don't need to be allocated.
We don't need lower level constructs if we can simply start by removing cruft and be more wary of adding it. Go back to KISS/YAGNI.
Re: Show HN: Simulating 20M Particles in JavaScript
#46Re: Show HN: Simulating 20M Particles in JavaScript
#47Oh, man, can't wait to send it to the UI team who write dead slow React apps. JS is blazing fast. Especially if written well.
JavaScript is probably the language who has seen the most human-hours spent on optimizations for the various engines. Too bad we cant just rely on JS only and have to involve a bunch of DOM operations, which is usually the slow part of the UIs we create.
No? With WebGL and soon WebGPU, or in this case here with writing to a imagebuffer and just passing that to canvas, you don't have to use the DOM anymore since quite a while.
(but then you don't get all the nice things html offers, like displaying and styling text etc)
Re: Show HN: Simulating 20M Particles in JavaScript
#48Earlier quoted context omitted.
I have done a few blog posts with interactive doodads like this. It takes a lot (like really a _lot_) more time to do, but I think it's the right way to go. There is so much noise on the internet caused by people casting their 2 cents into the void. Interactive thingywotsits may slow down individuals making posts, but there are a lot of individuals out there.
Not being a frontend dev, I have no idea how to even start making something like that. Are there some frameworks that make interactive simulations like that easier to make, or do you just do it the hard way?
Re: Show HN: Simulating 20M Particles in JavaScript
#49Earlier quoted context omitted.
there's also numpy and scipy in the webassembly python distro (pyodide). but the "kinda not" part more refers to first class scientific/numerical computing support. it's possible, but the libraries are all disjoint or are webassembly ports, etc.
Pyodide uses f2c for that, as mentioned in the link, but it isn't great, and barely works. You won't get the expected speed out of BLAS that way. Which is why the flang port it's about is attempting to compile to the actual primitives.
Re: Show HN: Simulating 20M Particles in JavaScript
#50Earlier quoted context omitted.
Pyodide uses f2c for that, as mentioned in the link, but it isn't great, and barely works. You won't get the expected speed out of BLAS that way. Which is why the flang port it's about is attempting to compile to the actual primitives.
i wonder if simd is working. that would be cool.