Repository navigation
Preallocate web assembly workers - #1
Merged
Merged
Conversation
…ly module is compiled. This puts the work of loading and starting up the javascript in parallel with the wasm compile, reducing overall load times.
…join a newly created thread!
…u can't join a newly created thread!" This reverts commit 9ec2778.
…u can't join a newly created thread!" This reverts commit 9ec2778. I realized that the issue was with the test - you can't join() in main() on a thread emscripten might immediately create. This can be fixed in production by proxying the main thread on a pthread, but that would elide giving access to the PThread.foo arrays in the test.
… into preallocate-workers
belraquib
pushed a commit
that referenced
this pull request
Dec 23, 2020
…mscripten-core#8744) This reverts commit 1d198e4. Apparently this cause a failure on the mac builder: https://ci.chromium.org/p/emscripten-releases/builders/ci/mac/b8911649373078606944 ``` cache:INFO: - ok Traceback (most recent call last): File "/b/s/w/ir/k/install/emscripten/emcc.py", line 3391, in <module> sys.exit(run(sys.argv)) File "/b/s/w/ir/k/install/emscripten/emcc.py", line 1894, in run final = shared.Building.link(linker_inputs, DEFAULT_FINAL, force_archive_contents=force_archive_contents, just_calculate=just_calculate) File "/b/s/w/ir/k/install/emscripten/tools/shared.py", line 1940, in link Building.read_link_inputs([x for x in files if not x.startswith('-')]) File "/b/s/w/ir/k/install/emscripten/tools/shared.py", line 1721, in read_link_inputs object_names_in_archives = pool.map(extract_archive_contents, archive_names) File "/b/s/w/ir/cipd_bin_packages/lib/python2.7/multiprocessing/pool.py", line 253, in map return self.map_async(func, iterable, chunksize).get() File "/b/s/w/ir/cipd_bin_packages/lib/python2.7/multiprocessing/pool.py", line 572, in get raise self._value IOError: [Errno 2] No such file or directory: u'/b/s/w/ir/tmp/t/emscripten_temp_oIE5H7_archive_contents/#1/12' ```
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Optimize end-to-end load time by allowing pthread workers to start loading prior to the webassembly compile step. This is done without a call to onmessage 'load', so these workers aren't ready yet.
This effectively puts the javascript parsing and loading of the workers in a separate thread. Once the webassembly module is loaded, the normal PTHREAD_POOL_SIZE logic kicks in, and greedily uses the preallocated threads.
The test was a little tricky, as the main thread can't join() created threads.