News for hackers. Stuff that matters.
Re:Automerge 2.0 by meitros on Monday January 30, 2023 @09:51PM (#34590245)
Was also curious how the comparisons were being done. Isn’t there a new non-negligible overhead of converting and passing data structures between js and rust?
Re:Automerge 2.0 by josephg on Monday January 30, 2023 @10:46PM (#34590673)
I've gotten similar performance from yjs (about 1 second from this test). To do it, I ran the benchmark itself in nodejs / V8. When I benchmarked in rust, the same data set was loaded from JSON and benchmarked using pure rust code.

Its not a fair test if you'll be running this code in a browser, since the rust code will need to be compiled to wasm (and suffer a ~3x performance penalty), while the javascript code will run at the same speed. But whether that matters to you depends on what you're doing.

Re:Automerge 2.0 by lll-o-lll on Monday January 30, 2023 @11:30PM (#34591132)
Wow, 3x perf penalty? I thought wasm was supposed to get us to “near native speeds”. Is this typical of the penalty paid, or something specific to automerge?
Re:Automerge 2.0 by josephg on Tuesday January 31, 2023 @12:02AM (#34591392)
Yep. At least, thats the slowdown rate I saw porting my own (very optimized) CRDT to wasm last year. I haven't measured automerge's wasm build but 3x slower is a reasonable baseline for wasm's performance compared to x86_64 code.

Some of that difference is a lack of auto-vectorization in wasm. Wasm SIMD is pretty new, and not well supported in wasm runtimes yet as far as I know.

Re:Automerge 2.0 by kevincox on Tuesday January 31, 2023 @05:51AM (#34593625)
3x semms unusually high. It definitely depends what you are doing but I recently compared a Ricochet Robots solver that I wrote (A* search) and it took only about 110% of native time. When I benchmarked it a couple of years ago it took about 2x so things have definitely improved a lot.

I'm sure the use case matters a lot. But at least in come cases the result can be very close to native.