From the glue code we can find that calling between JavaScript and C is very expensive. Although WebAssembly has performance close to native code, if the function interface design is unreasonable and the cross-language call frequency is too high, the overall executing efficiency will be greatly dragged down.
tips Checking the glue code generated by Emscripten is the most straightforward way to understand the internal processing flow when C and JavaScript interoperate.