andywer / andywer/threads.js

Consider experimental support for shared memory

オープン
#272 コメント 5 件 リアクション 4 件 担当者 0 名 GitHub で見る
enhancement question
主要言語
TypeScript
スター
3.5k
フォーク
173
PR マージ指標
30日以内にマージされた PR はありません

説明

Hi Andy @andywer ,

We are having a great success using your library and it unlocks all kinds of new possibilities for client-side compute, and, hopefully, will serve some COVID-19 researchers soon:
https://github.com/neherlab/webclades

One problem we faced is queue being on main thread and the pool being blocked from retrieving new tasks when main thread is busy (in our case with some heavy rendering): this leads to underutilization of resources.

I touched this problem a bit in this issue:
https://github.com/neherlab/webclades/issues/38

There is an experimental work happening in Mozilla that allows for shared memory
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer/Planned_changes

Do you think it can it be used to put queue in the shared segment of memory and to share it between workers, and execute dequeuing in the context of the worker itself, so that they don't have to tap the main thread?

I don't expect this is happening right now of course, especially that this particular API is not even released, but would be great to have this implemented one day.

Thanks again for the great library!

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。