perf: cache the bundles after we fetched them once #260
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.
PR Goal?
For a process using
convert_prealigned_text_to_offline_html()
in the Studio API to create a number of different readalongs, fetching the bundles is pretty slow, and has to be done repeatedly for each readalong created. Running the EveryVoice demo on our cluster, that represented an additional 3 second delay each time I clicked the synthesize button, on top of the actual synthesis time.The solution I adopted here is simply to save the bundle contents in a file-global variable in
make_package.py
, so we only ever try to fetch each of the two bundle files once.Memory cost: the bundles take 600KB together, so after the first fetch I'm reserving .6MB for this cache, which is pretty trivial.
Feedback sought?
sanity checking
Priority?
low
Tests added?
code already coveredYes
How to test?
Run the everyvoice demo with this branch of Studio vs main, and see synthesis run faster the second and subsequent time.
Confidence?
high
Version change?
Patch, but only when we decide we really want this included in the EV demo...