3 ms·
WebGPU + WebAssembly + TypeScript is going to be a pretty potent combo. I doubt Swift + Metal is more performant. Actually, when I translated some Swift code to
by auggierose 3y ago
WebGPU + WebAssembly + TypeScript is going to be a pretty potent combo.
I doubt Swift + Metal is more performant. Actually, when I translated some Swift code to JavaScript, it ran faster.
- pjmlp 3y agoWebGPU exposes 2015 hardware. If you failed to make Swift + Metal perform better than JavaScript, there is something really horrible with your code.
- auggierose 3y agoI'd say there are plenty of use cases where access to 2015 hardware capabilities is more than enough, given that you will profit from any automatic speed improvements beyond 2015 hardware as well. Which features beyond 2015 are you referring to? The code I ported wasn't Swift+Metal, it was just Swift. It certainly wasn't optimized in any way, but the Javascript one wasn't either. Javascript data structures are just faster, because they are fully imperative, the Swift ones are more expensive, despite some copy-on-write tricks. And remember, carefully written Javascript is just as fast as C.
- pjmlp 3y agoMesh shaders, ray tracing, unified memory, direct IO,... V8 JIT is hardly as fast as C, almost there yeah, there is still a speed bump.
- auggierose 3y agoYes, if you need these things, you will have to go native (although you will probably automatically benefit from unified memory). For many many things, you won't, and then the ability to target Apple/Windows/Linux with exactly the same code, pain-free GPU access etc, that's just great. The other day I checked if I can access from the browser the 3D coordinates of my space mouse, and it just works, based on a standard Web API (GamePad API). While from Swift, it would be a hassle to setup and maintain.