Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UE] 想问下 WASM 相关的支持问题 #1676

Closed
hewenning opened this issue Mar 20, 2024 · 6 comments
Closed

[UE] 想问下 WASM 相关的支持问题 #1676

hewenning opened this issue Mar 20, 2024 · 6 comments

Comments

@hewenning
Copy link
Contributor

我们项目想接一下 WASM 做一下 JS 的加速,不知道 Puerts 对于这块的支持怎么样,有没有相关的参考示例和文档呀~

@hewenning hewenning changed the title [UE] 我想问下 WASM 相关的支持问题 [UE] 想问下 WASM 相关的支持问题 Mar 20, 2024
@chexiongsheng
Copy link
Collaborator

wasm是v8内置的支持,按v8使用文档使用即可

@hewenning
Copy link
Contributor Author

Puerts 的 JIT 是可以使用的么,我们现在大部分业务逻辑都是 js 写的,想降低下 Game 线程的执行时间,目前其他优化点不多了,想从脚本层入手去做一些优化,不知道您这边有什么推荐的方案么?我看了下 wasm,对于虚幻引擎宿主来讲,是不是 js 直接调用 C++ 比 wasm 会更好些?您这边有什么相关的基于 Puerts 的脚本层加速方案可以参考么?

@chexiongsheng
Copy link
Collaborator

有些系统应用是没有权限jit的,比如ios。
wasm没有jit的情况,快不了多少,js调用c++肯定比调用wasm好。
我所知道一个act游戏用了puerts,战斗部分都用了ts,整体代码70%的占比,没什么性能问题,甚至关了jit,帧率也没降低。我觉得关键在于设计,设计不好会慢(另外一个反面是一个lua项目,在lua那算碰撞)。

@hewenning
Copy link
Contributor Author

现在 Puerts 中的 V8 是不是默认开启 JIT 的呀

@hewenning
Copy link
Contributor Author

我在 JsEnvImpl 中看到这这块代码,这个 WITH_V8_FAST_CALL 如果开启的话是不是函数调用的性能也会更高呢
#if PLATFORM_IOS
char Flags[] = "--jitless --no-expose-wasm";
v8::V8::SetFlagsFromString(Flags, sizeof(Flags));
#endif

#ifdef WITH_V8_FAST_CALL
char FCFlags[] = "--turbo-fast-api-calls";
v8::V8::SetFlagsFromString(FCFlags, sizeof(FCFlags));
#endif

@hewenning
Copy link
Contributor Author

这个是主要优化 C++ 到 JavaScript 的 API 调用么

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants