feat: improve triple generation speed by spinning up as a tokio::task #801
+117
−111
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.
We've been manually managing triple protocols via configs like
max_concurrent_generation
in our main runtime thread which is not quite efficient. By spawning them as tokio tasks, we should see a good speedup. We also no longer need to manage the amount of work we need ourselves, since the Tokio runtime has features like spinning up more threads to further accommodate the workload that we push to it, with work stealing such that no task takes too long.From what I've seen our average elapsed=35s of triple completion went down to 15-25s averages with this change.
This is however a potential instability to add while we are releasing mainnet, so should only be merged if we have high confidence in this so please test this for yourself before pushing this in