Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Multithreading: separate diffing and DOM operations #18

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

mbasso
Copy link
Owner

@mbasso mbasso commented Dec 13, 2018

At the moment asm-dom uses only one thread, the main one, to perform its work.
This is an experimental PR that aims to improve the performance by dividing the diffing algorithm and the DOM operations in two different threads. This is now possible thanks to the support of WebAssembly threads in Chrome 70, previously disabled due to a set of reasons involving spectre and meltdown. So, we can now use pthreads and emscripten.
We should firstly change our Makefile to setup the new compilation, improve the test suite and runs it directly in the browser, since we cannot mock Worker and SharedArrayBuffer in node.
After that we can develop the new core part and benchmark it to see if it is better than the existing one.
Here is a list of things that needs to be done:

  • update Makefile
  • improve test suite
  • implement a Producer/Consumer pattern
  • test and update benchmarks
  • update examples
  • update documentation

@mbasso mbasso changed the title [WIP] Multithreading [WIP] Multithreading: separate diffing and DOM operations Dec 13, 2018
@webern
Copy link

webern commented May 3, 2019

Is this PR required before we can make http calls to a backend (or other site) asynchronously? i.e. if we need to make a call to a backend, in the current implementation, prior to this PR, would we block the UI?

@mbasso
Copy link
Owner Author

mbasso commented May 4, 2019

Hi @webern,
at the moment there are no plans to develop an API to make HTTP requests... I think that this kind of funtionalities shouldn't be place inside the asm-dom package but in some helper libreries instead. For more information refer to issue #17.
However, emscripten has just an API to fetch data from remote servers both synchronously and asynchronously. If you want to see an example, try to check out this tutorial.
What do you think? 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants