Binaryen C API vs wasm-opt #5106
-
I am thinking of creating a programming language that compiles to wasm. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
There are examples of compilers using both of those approaches. The main advantage of using the C API is that you don't need to worry about having to manage multiple binaries. There also might be some performance benefits to constructing Binaryen IR directly via the API rather than parsing the IR from a file. On the other hand, the main advantage of using wasm-opt is that it becomes optional, so for debug builds you can just not run it if you want. Also, if you do use the API, you'll probably still want the ability to print the Wasm module directly from your compiler to help with debugging the compiler. |
Beta Was this translation helpful? Give feedback.
There are examples of compilers using both of those approaches. The main advantage of using the C API is that you don't need to worry about having to manage multiple binaries. There also might be some performance benefits to constructing Binaryen IR directly via the API rather than parsing the IR from a file. On the other hand, the main advantage of using wasm-opt is that it becomes optional, so for debug builds you can just not run it if you want. Also, if you do use the API, you'll probably still want the ability to print the Wasm module directly from your compiler to help with debugging the compiler.