5 ms·
Maybe there should be a tool from linters or VMs to warn against arguments adaptation, monomorphisation. For the rest it is a lot of know how is JS that is for
by hokkos 9y ago
Maybe there should be a tool from linters or VMs to warn against arguments adaptation, monomorphisation. For the rest it is a lot of know how is JS that is for free in with more performance minded languages. At the end with the optimized JS is is 4 times faster, but still 6 times faster in WASM it seems.
- bcoates 9y agoIt's only necessary in edge cases of super-hot code, avoiding argument adaptation "because performance" is a bad idea. It's also a v8 specific weakness, it's not hard to imagine a small fix getting rid of the performance penalty.
- kjksf 9y agoGiven that this contrasts a JavaScript implementation with Rust implementation compiled to WASM: my 5 minute investigation shows that Rust doesn't have optional arguments at all. So in Rust you would be forced to write it the way you consider to be "bad idea". Many people think that default function arguments are a bad idea and languages like Rust or C or Go or Java don't even have them.
- qarioz 9y agoyou get creative, passing map, passing Option. it's very trivial to do.