Mesh shaders, ray tracing, unified memory, direct IO,...
V8 JIT is hardly as fast as C, almost there yeah, there is still a speed bump.
Re:Interoperability: Swift’s Super Power
by auggierose on Friday September 22, 2023 @06:02PM
(#37618366)
Yes, 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.
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.