Skip to content

Commit e860b9c

Browse files
committed
Use promise.all to load sorted results in parallel
1 parent 2e368bf commit e860b9c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

Diff for: src/librustdoc/html/static/js/search.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -2485,10 +2485,15 @@ function initSearch(rawSearchIndex) {
24852485
innerRunQuery();
24862486
}
24872487

2488+
const [sorted_in_args, sorted_returned, sorted_others] = await Promise.all([
2489+
sortResults(results_in_args, true, currentCrate),
2490+
sortResults(results_returned, true, currentCrate),
2491+
sortResults(results_others, false, currentCrate),
2492+
]);
24882493
const ret = createQueryResults(
2489-
await sortResults(results_in_args, true, currentCrate),
2490-
await sortResults(results_returned, true, currentCrate),
2491-
await sortResults(results_others, false, currentCrate),
2494+
sorted_in_args,
2495+
sorted_returned,
2496+
sorted_others,
24922497
parsedQuery);
24932498
handleAliases(ret, parsedQuery.original.replace(/"/g, ""), filterCrates, currentCrate);
24942499
if (parsedQuery.error !== null && ret.others.length !== 0) {

0 commit comments

Comments
 (0)