perf(platform/wasm): remove useless build flags#45
Merged
cloudwu merged 1 commit intocloudwu:masterfrom Oct 23, 2025
Merged
Conversation
62a53c1 to
0c9a1c6
Compare
0c9a1c6 to
6d69671
Compare
Owner
|
如果只是启动,是不是应该把启动线程和让工作线程分成两个步骤就可以? 比如先把 worker 都启动起来,但不工作。然后从主线程发起启动信号? |
Contributor
Author
|
想了下是可以。比如在 app init 里创建线程,然后在 frame callback 里等待 worker 启动,接着执行。 |
Owner
|
我下周试试。在 init callback 应该就可以了 |
cloudwu
added a commit
that referenced
this pull request
Oct 30, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PS: 我今天尝试为 ltask 添加原生 WASM 多线程 API支持, 即 WASM Worker, 结果失败了。原因在于: WASM Worker 的启动总是异步的, 需要主线程让出事件循环后才会启动。而 WASM 在执行过程中不会让出,如果要实现这个功能,让 soluna 运行过程中让出, 会比较麻烦; 并且理论上需要在 thread_start 启动之后立即让出,否则
boot.mainthread_wait会死锁。这个异步启动方式在写 js 代码时应该显得比较自然, 但是从 wasm 角度来看挺别扭的。如果我的理解没有错的话 pthread 在 emscripten 的实现实际上也是基于一些预先创建的 wasm worker
通过 emscripten 官方文档对比 pthread 和 wasm worker, 我认为除了体积较小外, wasm worker 没什么特别的优势。FYI: https://emscripten.org/docs/api_reference/wasm_workers.html#pthreads-vs-wasm-workers-which-one-to-use