Skip to content

Commit

Permalink
Use promise.all to load sorted results in parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
notriddle committed Mar 18, 2024
1 parent 2e368bf commit e860b9c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/librustdoc/html/static/js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -2485,10 +2485,15 @@ function initSearch(rawSearchIndex) {
innerRunQuery();
}

const [sorted_in_args, sorted_returned, sorted_others] = await Promise.all([
sortResults(results_in_args, true, currentCrate),
sortResults(results_returned, true, currentCrate),
sortResults(results_others, false, currentCrate),
]);
const ret = createQueryResults(
await sortResults(results_in_args, true, currentCrate),
await sortResults(results_returned, true, currentCrate),
await sortResults(results_others, false, currentCrate),
sorted_in_args,
sorted_returned,
sorted_others,
parsedQuery);
handleAliases(ret, parsedQuery.original.replace(/"/g, ""), filterCrates, currentCrate);
if (parsedQuery.error !== null && ret.others.length !== 0) {
Expand Down

0 comments on commit e860b9c

Please sign in to comment.