Better HN
topnewbestaskshowjobs
Log inSign up

v_pragma

4 karma · joined Jan 13, 2019 (7y ago) · 11 submissions

Submissions

comment 6y ago · link · parent

> AS hasn't scalar replacement optimization pass yet which JavaScript definitely has. Also it will be much better after implementing tuple / records which depends on multi-value proposal for now.

Yes, I do use a lot of small objects. That's an interesting information, I'll keep an eye on multi-value proposal, thank you!

> Most of people uses benchmark.js which also measure js <-> wasm interop overhead which usually main bottleneck.

Nope, I loaded all the data into WA module upon initialization and don't perform any additional synchronization between WA and JS afterwards (which is also kind of unfair advantage for WA).

comment 6y ago · link · parent

GC aside, I've inspected assembly code (.wast files) for top 10 hottest methods in my code, and it was pretty much perfect, Rust and C will probably end up with something similar. However, there was no performance improvements whatsoever, those methods performed similarly to their JS equivalents.

UPD: modern JS engines are extremely capable of optimizing stuff and they can probably come up with machine code similar to what Rust or C will produce given that you keep your code predictable and optimization-friendly.

comment 6y ago · link · parent

Unfortunately, no, it's a commercial closed-source project. I profiled both JS and WA versions, the hottest methods took basically the same amount of time in both versions, except that WA build additionally spend ~25% of all time in __retain or something like that.

comment 6y ago · link · parent

Keep in mind that WebAssembly is not a silver bullet for performance, and carefully crafted JS application (written in engine-friendly way) will perform roughly the same or even better than its WA equivalent. I've rewritten chunk of my math-intensive app in AssemblyScript half a year ago - it took me about a month to fight through all the compiler bugs, I used every optimization possible (used floats everywhere, disabled array boundary checks, disabled GC for 70% of classes) and still end up with a binary that is 30% slower than the original JS code. It was mostly AssemblyScript's GC, which was extremely slow (and probably still is), and with GC completely disabled (which is an unfair advantage for WA) performance was almost the same.

5.

Unity ConfigurableJoint Guide(medium.com ↗)

5 points · by v_pragma · 6y ago · discuss

6.

Deep Dive into Configurable Joints in Unity(medium.com ↗)

1 points · by v_pragma · 6y ago · discuss

7.

Deep Dive into Configurable Joints in Unity(medium.com ↗)

1 points · by v_pragma · 6y ago · discuss

8.

12 strange things that can happen after installing an NPM package(medium.com ↗)

5 points · by v_pragma · 7y ago · discuss