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

matrix例子中 为什么webAssembly用时比js更长呀 #7

Open
tttousa opened this issue Nov 9, 2019 · 5 comments
Open

matrix例子中 为什么webAssembly用时比js更长呀 #7

tttousa opened this issue Nov 9, 2019 · 5 comments

Comments

@tttousa
Copy link

tttousa commented Nov 9, 2019

No description provided.

@tttousa
Copy link
Author

tttousa commented Nov 9, 2019

如题

@tttousa tttousa changed the title matrix matrix例子中 为什么webAssembly用时比js更长呀 Nov 9, 2019
@Hanks10100
Copy link
Owner

现在 js 引擎的优化已经很厉害了,尤其是对 for 循环。 wasm 在浏览器里复用的是一部分 js 引擎的实现,性能还不行,跑在独立的 runtime 里会好一些。

@tttousa
Copy link
Author

tttousa commented Nov 14, 2019 via email

@Hanks10100
Copy link
Owner

可以自己实验一下。 wasm 不是很适合做渲染,做高性能运算还可以,主要是目前 js 和 wasm 之间的传值效率不够高,如果频繁互相调用的话,挺影响性能的。

另外 wasm 是跑在 CPU 里的,大部分和 js 一样用在主线程里,浏览器主线程已经够忙的了, WebGL 可以写 shader 跑在 GPU 里,用它做渲染性能更好一些。

@tttousa
Copy link
Author

tttousa commented Nov 15, 2019 via email

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