Allow image decoding to happen in parallel when parsing SOGS #122
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.
While the decoding of images for the SOGS format was happening asynchronously, the process was awaiting the result each time. This prevents the browser from decoding the images in parallel.
This PR changes the loading function such that once the decoding of relevant images for an attribute is done (e.g. scales, colors, shN) the processing for that attribute begins. This ensures that the decoding of all images can start as soon as possible, improving loading times.
Here's an image showing the process before this PR (using the SOGS example):


And with this PR:
Note that the above images don't have the exact same time scale. Measuring the full span of
unpackPcSogsthe duration drops from ~1900ms to ~1600ms (measured while profiling in Chrome dev tools).