EM_ASM 中的 js 代码会发生什么? [英] what happens to the js code inside EM_ASM?

查看:35
本文介绍了EM_ASM 中的 js 代码会发生什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Enscripten 中,EM_ASM 函数中的代码会发生什么变化?我的意思是该代码是否在运行时被编译或解释?如果编译,那么它在浏览器中是否比本地解释的 js 运行得更快或更慢?

In Enscripten what happens to the code inside EM_ASM function? I mean if that code get compiled or interpreted at runtime? If compiled then if that runs faster or slower than native interpreted js in browser?

推荐答案

基本上它会将该代码放在您的 .js 文件中,并且 Emscripten 代码将调用它.除了从 Wasm 切换到 JS 代码而导致的任何性能损失之外,它将具有与任何其他 JS 代码完全相同的性能.

Basically it'll place that code inside your .js file and the Emscripten code will call it. It will have the exact same performance as any other JS code, excepting any performance penalty caused by switching from the Wasm to JS code.

这篇关于EM_ASM 中的 js 代码会发生什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆