hono icon indicating copy to clipboard operation
hono copied to clipboard

Just an idea : Replacing simple computational processes with WebAssembly

Open usualoma opened this issue 1 year ago • 2 comments

What is the feature you are proposing?

For simple computational processes such as "computing hash values", replacing them with WebAssembly may speed up the process.

https://github.com/honojs/hono/pull/1858/files#diff-85712e79b6fb34a25a128de109f2b36f0d63435bc39e521e9268d315e209f402R32-R39

The results of my benchmarks are as follows: "node" and "deno" have a large overhead at call time, but WebAssembly is still faster when the data size is large. "bun" has a small overhead, but WebAssembly is always faster.

https://gist.github.com/usualoma/760bf5fe5234ff1505767d36f3d85fce

Whether such a replacement should actually be made requires careful consideration, but it is good to keep in mind that such an option is available.

usualoma avatar Jan 01 '24 04:01 usualoma

@usualoma

This is a very interesting idea, whether we use it or not "now"!

The results of my benchmarks are as follows: "node" and "deno" have a large overhead at call time, but WebAssembly is still faster when the data size is large. "bun" has a small overhead, but WebAssembly is always faster.

One more thing, I would like to measure the performance with Cloudflare Workers, but worked is probably for development, so the numbers may not be accurate. And, we can measure it in the actual production environment, but it would be more uncertain than local.

Either way, we'd like to consider it.

yusukebe avatar Jan 01 '24 14:01 yusukebe

And "WASM Router" would also be interesting, although it may take longer to load in the initial stage.

yusukebe avatar Jan 01 '24 14:01 yusukebe