HNHacker News
TopNewBestAskShowJobs

tristanhoy

2 karma · joined March 15, 2015

submissionscomments
tristanhoy··on We built a faster WASM-bindgen (2.5×) for high-frequency JavaScript<–>Rust calls
wasm-bindgen generates a lot of marshalling code on both sides with dynamic allocations and this kills performance.

For low-level algorithms, this means that JS + wasm-bindgen will only be marginally faster than pure JS - the overhead of crossing the boundary is that much of an issue: https://dev.to/bence_rcz_fe471c168707c1/rust-webassembly-per...

With zaw, it uses a pre-allocated, fixed-width buffer for communication, same technique as Bence uses in that article.

It's a night and day difference.

tristanhoy··on We built a faster WASM-bindgen (2.5×) for high-frequency JavaScript<–>Rust calls
A few years back we tried moving our in-memory database engine from Typescript to Rust but found the prototype gains were pretty much deleted by wasm-bindgen because of the high call frequency in our setting.

Moving more of our stack into Rust wasn't viable, so we shelved the project and focused on other areas.

Turns out this is a pretty common experience.

Now we're trying again, but this time with our own binding protocol. It’s 2.5× faster at the boundary, but more importantly, it shifts the break-even point dramatically. Offloading to WASM becomes viable at much smaller data sizes (e.g. ~100 elements), enabling cases that weren’t previously worth it — including ours.

The only trade off is significantly worse DX - the bindings are manual and more verbose, but I'm sure someone could solve this with codegen/macros on either side. For now we're focused on performance.

It's pretty much neck and neck between our Rust and Zig implementations so take your pick.

tristanhoy··on The case against blockchain for identity
And that's what's so hilarious about putting a content hash on a blockchain, when you can just give it to someone over HTTPS. The hash is plenty immutable all on its own.

Strong transaction ordering can give you proof of existence at a certain point in time, but that's not useful in an identity context.

tristanhoy··on The case against blockchain for identity
Exactly, it's a tamper proof P2P file system.

But it's far from immutable. Torrents die every day because people stop hosting them. The best thing you can do to keep an important but unpopular file alive is ongoing upkeep: host it on your own infrastructure, or pay for an Amazon S3 torrent.

IPFS and filecoins are exactly the same. The availability depends on either popularity, running your own server and hoping you don't have a fire, or ongoing payments for redundant storage.

That's not immutable.

Blockchain has a much stronger immutability guarantee, because everyone involved is economically incentivised to maintain every single transaction that ever took place, no matter how insignificant.