Remove stackPrefetch configuration to let apps configure themselves #101
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.
Hello, I am an intern at Google currently investigating ways in which to get optimal performance out of medical image viewers that integrate with the Google Healthcare API. This pull request is aimed to help open source medical image viewers get better performance when using this viewport component, by removing the stackPrefetch configuration so that viewers can set the maximum number of simultaneous requests to their preferred setting.
With the introduction of HTTP/2, there is no longer a limit of 6 simultaneous requests to a specific origin. Instead, one connection is made to a given origin and a hypothetically infinite number of requests can be made through that one connection (although browsers such as chrome do eventually limit these connections which appears to be around 100 requests). In practice, changing the maxSimultaneousRequests to values as high as 50 or 75 yields a significant increase in performance on existing medical image viewers such as Ohif. Additionally, cornerstoneTools already has defaults set for this value that correspond to different browsers, so there should be no need to set this value to 6 manually.
Having this configuration set in the viewport means that it will overwrite the existing configuration of viewers that may want to set the max simultaneous requests to a larger value, which is why I am proposing that these lines be removed so that medical image viewers that utilize this library can set these options themselves outside of the component to find the settings that yield the best performance for them.
I have tested this change with Ohif and the example pages and the viewport still functions as expected. I also tested with different values for
preserveExistingPool
andmaxImagesToPrefetch
. However, as I am not 100% familiar with this codebase, if it is essential to the functionality of this viewport thatmaxImagesToPrefetch
is set toInfinity
andpreserveExistingPool
is set tofalse
, then these values can still be set and themaxSimultaneousRequests
field can be left blank, as seen in the setConfiguration method in cornerstoneTools. So the below solution could also be used if these two values need to be set to their defaults: