A
A
AndreyMasalov2018-11-01 10:25:31
JavaScript
AndreyMasalov, 2018-11-01 10:25:31

Can Babylon.js code be compiled into WebAssembly?

Hello.
I am developing a 3D game using the Babylon.js framework. I chose this engine because the code is written in JavaScript (I am only familiar with it) and there is support for mobile devices. In addition, this engine is very light. During development, I encountered the following problem. As the project grew, the scene with 3D objects began to give out low FPS. I found information that this problem can be solved using WebAssembly. Question: Is there any way to port code from JavaScript to WebAssembly?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
Y
Yaroslav Sivakov, 2018-11-01
@AndreyMasalov

WebAssembly assumes that your source code is written in a strongly typed language. Therefore, we will not see the js => wasm translator soon. I think that in order to speed up your project, you still need to identify bottlenecks first. If they are connected with your code, then it will be possible to rewrite its individual parts, say, in Rust with translation to wasm.

#
#, 2018-11-01
@mindtester

formulate questions more simply, for example js to wasm?
ps while the problem may not be in the engine, but in the architecture of your application

M
MaxGraey, 2018-11-07
@MaxGraey

It is not necessary to rewrite bottlenecks in Rust, which is not so easy, especially for a web developer. For example, it can be relatively easy to port to AssemblyScript (a superset of Typescript that compiles to WebAssembly). Despite the fact that such work is even already underway in this thread (so far only for mathematics): https://github.com/vtange/Babylon.js/commits/math2wasm
You can also read the discussion here:
https://github.com /BabylonJS/Babylon.js/issues/324...
But as a person familiar with AS, I can say that it can be done much more efficiently.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question