TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: Zaplib – Speed up your webapp with Rust+Wasm

175 点作者 stevekrouse大约 3 年前

12 条评论

janpaul123大约 3 年前
Hey HN, one of the creators here! I made it at Cruise because it was super painful to develop <a href="https:&#x2F;&#x2F;webviz.io" rel="nofollow">https:&#x2F;&#x2F;webviz.io</a> with manual memory management (lots of ArrayBuffers), WebWorkers, etc. I thought that there must be a better way.<p>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&#x2F;3d rendering faster? Would you want to use something like Zaplib?<p>(You may have seen my blog yesterday about the subtleties about Wasm vs JS&#x2F;TS: <a href="https:&#x2F;&#x2F;zaplib.com&#x2F;docs&#x2F;blog_ts++.html" rel="nofollow">https:&#x2F;&#x2F;zaplib.com&#x2F;docs&#x2F;blog_ts++.html</a>)
评论 #30963801 未加载
评论 #30965722 未加载
FullyFunctional大约 3 年前
Hot damn I nearly got a seissure from watching the demo page. I&#x27;m sure flickering mess I see with Firefox 98.0.2 wasn&#x27;t what they intended!<p>I can&#x27;t really say much else about it, but it looks interesting.<p>ADD: not complaining about the down votes, but I wasn&#x27;t kidding. I think it&#x27;s malfunctioning in my browser in a literally dangerous way. I would record a video of it if it wasn&#x27;t so annoying to upload. I&#x27;m guess nobody else sees this?
评论 #30965575 未加载
评论 #30965994 未加载
chaosprint大约 3 年前
Great work. Put it on my favourite list now. Do you have any tips for debugging? I use the same combo Rust-WASM for my Glicol music programming language:<p><a href="https:&#x2F;&#x2F;glicol.org" rel="nofollow">https:&#x2F;&#x2F;glicol.org</a><p>The audio runs in AudioWorklet thread while I guess for Zaplib it runs in Workers, right? Did you use SAB in Zaplib?<p>For me, one use case is to use Zaplib for visualising the audio. The built-in canvas and 2d drawing is really slow. Yet one concern is for the support on Safari. It really has a slow support for SAB. I have to switch to postMessage on Safari as a compromise.
评论 #30961304 未加载
评论 #30961403 未加载
ggerganov大约 3 年前
I&#x27;ve been using a similar stack (C++ and WASM) to build some simple applications and I enjoy it very much. For the UI components, text rendering and layout I use Dear ImGui [0] as I am very familiar with it and it allows me to implement GUIs very fast. The biggest convenience is that you can run the same code both as a native application and as a web app. The biggest drawback is you usually get 100% CPU usage when there is an active animation in the WebGL canvas because you need to redraw everything (similar to the OP&#x27;s example).<p>If you are interested, checkout my Github template repo [1] - it contains a few examples:<p>[0] <a href="https:&#x2F;&#x2F;github.com&#x2F;ocornut&#x2F;imgui" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;ocornut&#x2F;imgui</a><p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;ggerganov&#x2F;ggweb" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;ggerganov&#x2F;ggweb</a>
评论 #30965039 未加载
评论 #30961182 未加载
评论 #30961109 未加载
rklaehn大约 3 年前
This looks awesome. I have been playing with WASM and rust, trying to get rusqlite to work with persistence, among other things.<p>I notice that you also came to the conclusion that having all io async is not the way to go for rust.<p>How do you wrap the async js io apis so they can be used in sync rust? I have seen different approaches for this: 1. an additional service worker &#x2F; thread and atomics. 2. rewrite the entire WASM in some sort of continuation passing style.
评论 #30969624 未加载
wngr大约 3 年前
Nice project, although pretty opinionated. But I guess you have to do that when targeting the crazy browser environment with all its weird quirks (at least for non-web devs)..<p>Somewhat related is a library I&#x27;ve been working on to generate an ffi between Rust and js code: <a href="https:&#x2F;&#x2F;github.com&#x2F;cloudpeers&#x2F;ffi-gen" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;cloudpeers&#x2F;ffi-gen</a><p>Also I really like your <i>universal_thread</i> abstraction, hiding the whole web worker mess. I did a similar thing here: <a href="https:&#x2F;&#x2F;github.com&#x2F;wngr&#x2F;wasm-futures-executor" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;wngr&#x2F;wasm-futures-executor</a>
priansh大约 3 年前
This is really cool but I can’t say I’m a fan of Zapium given it would move to a commercial license in the future. If you have to ship CEF anyhow, what is the performance advantage to licensing and using Zapium over just compiling WASM and shipping binaries with Electron? FWIW — this is how Java, .NET, etc packaging is done for interop with Electron.<p>I can understand from an ease of use perspective to have the bridge in between but it wouldn’t be worth subjecting a codebase to commercial licensing IMO. It’s not a whole lot more work to use process calls instead there so it seems an odd choice to commercialize that aspect in particular.
评论 #30962893 未加载
评论 #30962703 未加载
areis大约 3 年前
Super cool! I&#x27;m sure this is highly situational, but roughly how much faster can Rust -&gt; WASM be than vanilla JS? 2x, 10x, 100x?
评论 #30961372 未加载
andrew_shay大约 3 年前
Great to see more work in the Rust+Wasm space. Interested in trying this out at some point.
cglong大约 3 年前
Just tried opening this on my cheap Android phone; really appreciate that the whole page stayed usable! There was some noticable lag though, which I don&#x27;t see on advanced Three.js apps. So some further performance tuning might be needed :)
评论 #30961389 未加载
nrabulinski大约 3 年前
None of the demos work in Safari on iOS.<p>iPhone XS on iOS 15.0.2
评论 #30961035 未加载
jxjshaw大约 3 年前
this is dope!!