HNHacker News
TopNewBestAskShowJobs

janpaul123

677 karma · joined August 31, 2012

submissionscomments
janpaul123··on Vesuvius Challenge
Haha yesss, nerd-sniping is the goal!

I believe that there could be quite a few different ways in which this could get solved. The potential solution space is huge, so you might just stumble upon something interesting if you wander places where no one else is looking..

Good luck!!

janpaul123··on Vesuvius Challenge
<3
janpaul123··on Vesuvius Challenge
Awesome!! They're so great; it's been such a joy to be welcomed into their project.

And totally — especially if there is indeed a larger library still waiting to be excavated. Who knows how many completely unique texts are waiting to be read, if we just have the right method to do so?!

janpaul123··on Vesuvius Challenge
We don't know. But it's the most fun!
janpaul123··on Vesuvius Challenge
One of the organizers here! Would love to welcome everyone's questions, ideas, etc! :)
janpaul123··on Show HN: Zaplib – Speed up your webapp with Rust+Wasm
We used approach #1: https://github.com/Zaplib/zaplib/blob/7976d39775dd1642f20d8b...

I might write a blog post about this, since it's pretty fun / tricky stuff!

janpaul123··on Show HN: Zaplib – Speed up your webapp with Rust+Wasm
Something clearly went wrong with my fix when testing it — I think we got it now! Thanks again both!!
janpaul123··on Show HN: Zaplib – Speed up your webapp with Rust+Wasm
Yeah, Wasm is quite fast these days, and there is still more room to grow!
janpaul123··on Show HN: Zaplib – Speed up your webapp with Rust+Wasm
Overhead of calling into JS from Wasm is very low; DOM calls are no problem since the DOM call itself is much slower than the overhead of switching from Wasm to JS. See e.g. this article from ~4 years ago: https://hacks.mozilla.org/2018/10/calls-between-javascript-a...

There are even some libraries that try to mimic React directly from Rust, such as https://yew.rs/ (though in my experience they can be a bit harder to use than Zaplib, since they require you to learn about traits, closures, etc, and tend to also run into borrow checker issues more often -- all of those are things we try to avoid having to learn in Zaplib!)

janpaul123··on Show HN: Zaplib – Speed up your webapp with Rust+Wasm
Oof — sorry for the late response but I'm seeing this too now. Pushed a fix, should be up soon. Tnx for reporting!
janpaul123··on Show HN: Zaplib – Speed up your webapp with Rust+Wasm
Yeah exactly; the headers are such a pain to set up!
janpaul123··on Show HN: Zaplib – Speed up your webapp with Rust+Wasm
Re audio: yeah we currently only use Web Workers and we don't have audio support yet. We do use SAB, but we're thinking of adding support for running without SAB so you can use it with older browsers.
janpaul123··on Show HN: Zaplib – Speed up your webapp with Rust+Wasm
Yeah, might be the continuous animation that we're doing! Or do you mean the startup time? There's definitely still a lot of room for us to optimize stuff :)
janpaul123··on Show HN: Zaplib – Speed up your webapp with Rust+Wasm
Great question! I wrote a blog post yesterday going into the nuances of this a bit: https://zaplib.com/docs/blog_ts++.html The short of it is that Rust+Wasm isn't much faster than highly optimized JS in most situations, but it's hard to optimize it. In Rust it's a lot easier to get to the same level of performance as highly optimized JS.

We also support building compiling to native though, and we've found that the typical difference between Wasm and native apps is about 2x (on most metrics).

janpaul123··on Show HN: Zaplib – Speed up your webapp with Rust+Wasm
That looks awesome!

For debugging we support full Rust source maps in the browser (using DWARF). :D (This is something that wasm-bindgen doesn't support, for example!) See https://zaplib.com/docs/developer_environment.html#chrome-de... for how to set it up.

Since we also support running the Rust code natively (even when doing rendering!) you can also use that and attach whatever native debugger you like. That same page also has info on how to set up native debugging with VSCode.

janpaul123··on Show HN: Zaplib – Speed up your webapp with Rust+Wasm
Oh cool; you're also using this for robotics I presume (based on your Twitter profile)? Makes sense; lots of data to process there.
janpaul123··on Show HN: Zaplib – Speed up your webapp with Rust+Wasm
Very cool! We do throttle our animations to the screen's refresh rate using requestAnimationFrame, so you shouldn't necessarily get 100% CPU unless the animation takes up the entire "frame budget" (on my machine the main example in the introduction is more like ~40-50% CPU on Chrome).
janpaul123··on Show HN: Zaplib – Speed up your webapp with Rust+Wasm
Safari only very recently added support for threading in Wasm, which we use. Try upgrading to the latest iOS (15.4.1)?

It's definitely bleeding-edge stuff; we should add some backwards compatibility for (slightly) older browsers though.

janpaul123··on Show HN: Zaplib – Speed up your webapp with Rust+Wasm
Hey HN, one of the creators here! I made it at Cruise because it was super painful to develop https://webviz.io with manual memory management (lots of ArrayBuffers), WebWorkers, etc. I thought that there must be a better way.

Very curious to hear stories from other folks building intensive stuff in the browser. How are you dealing with performance issues in Javascript? Have you tried using Rust or C++ with WebAssembly for parts of your apps? How did you make 2d/3d rendering faster? Would you want to use something like Zaplib?

(You may have seen my blog yesterday about the subtleties about Wasm vs JS/TS: https://zaplib.com/docs/blog_ts++.html)

janpaul123··on TypeScript as fast as Rust: TypeScript++
Wow cool!
janpaul123··on TypeScript as fast as Rust: TypeScript++
Yes!!
janpaul123··on TypeScript as fast as Rust: TypeScript++
If Apple would truly commit to making Swift applications run cross-platform (Windows, Mac, Linux, Android, iPhone, Web/wasm) in a performant way, they could completely take over and become the next stack for performance-intensive applications.
janpaul123··on TypeScript as fast as Rust: TypeScript++
Nectarjs is interesting; I wasn't aware of that. How did it manage to avoid (for example) a garbage collector without making changes to the language?
janpaul123··on TypeScript as fast as Rust: TypeScript++
You didn't see my face when I wrote that ;)
janpaul123··on TypeScript as fast as Rust: TypeScript++
Yeah I meant speed of execution. Sorry for the letdown! But https://github.com/swc-project/swc is a very fast Typescript compiler written in Rust :)
janpaul123··on TypeScript as fast as Rust: TypeScript++
Ah yes; I did see that but forgot to mention it: https://makecode.com/language
janpaul123··on TypeScript as fast as Rust: TypeScript++
Tnx; fixing!
janpaul123··on TypeScript as fast as Rust: TypeScript++
Yep, but it doesn't really solve any of the problems that I mention in the article, unfortunately. The Typescript familiarity part is nice, but it doesn't really work well with existing code; you still have to set up Wasm-JS communication; it doesn't work with existing ArrayBuffers / multiple memories; it's garbage collected if you want to use more complex objects; etc. In many ways it's better to use Rust (which looks a bit like Typescript) than AssemblyScript..
janpaul123··on TypeScript as fast as Rust: TypeScript++
Yep, but it doesn't really solve any of the problems that I mention in the article, unfortunately.
janpaul123··on TypeScript as fast as Rust: TypeScript++
Yeah I hear you; and even allude to that in some parts of the article, like this part:

> Another idea to make Typescript–– a bit less restrictive and more ergonomic, would be to use reference-counting of objects, and then try to optimize most away using compile-time reference counting as pioneered by Lobster. This gives most of the advantages of manually managed memory, but makes the ownership model much easier to reason about. It is however slightly less performant, and more importantly, makes performance less predictable, since it becomes more reliant on compiler cleverness.

Even Rust can hide actual performance behind abstractions, and I've already been bitten by that a few times.. Not sure what the right solution is here, but I agree that it's super important to think about this when designing a language like this.

← PreviousPage 2 of 4Next →