douliang2087 2019-07-19 14:25
浏览 456

如何在使用golang创建的wasm中实现多线程?

I am working on a javascript project which initially had all complex logic written in JS. However it was very slow so we had ported all the complex logic to golang now due to architectural constraints we cannot call APIs of the golang, so we moved towards wasm where you build your golang code into a wasm file and call it from your js code and hence eliminating API calls.

Now everything was working fine until we have received some complex object which takes a lot of time if you execute through wasm but takes only few seconds if you run it through golang. So my question is can I implement multithreading into wasm file loaded in browser?

  • 写回答

1条回答 默认 最新

  • dongzhuo1498 2019-07-19 14:40
    关注

    So my question is can I implement multithreading into wasm file loaded in browser?

    In a word: No.

    Multithreading isn't officially supported in WASM at all yet. It's still just a proposal. That said, there's already an issue tracking this for Go/WASM.

    So what this means, in practical terms, is that, optimistically, Go 1.14 is the first Go version likely to include (experimental) WASM Threading support, which will probably come out 2020Q1. Stable support likely will take at least one more Go release cycle, so perhaps 2020Q3 you'll be able to use this in production.

    评论

报告相同问题?

悬赏问题

  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示