From fdbc8d08a63a3d34b7aebabb2f18a768462a98c4 Mon Sep 17 00:00:00 2001 From: binarycat Date: Fri, 8 Aug 2025 11:55:00 -0500 Subject: [PATCH] rustdoc search: add performance note about searchIndexUnstable check --- src/librustdoc/html/static/js/search.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/librustdoc/html/static/js/search.js b/src/librustdoc/html/static/js/search.js index da15433622af..1ed789f63d5d 100644 --- a/src/librustdoc/html/static/js/search.js +++ b/src/librustdoc/html/static/js/search.js @@ -3291,6 +3291,12 @@ class DocSearch { } // sort unstable items later + // FIXME: there is some doubt if this is the most effecient way to implement this. + // alternative options include: + // * put is_unstable on each item when the index is built. + // increases memory usage but avoids a hashmap lookup. + // * put is_unstable on each item before sorting. + // better worst case performance but worse average case performance. a = Number( // @ts-expect-error this.searchIndexUnstable.get(aaa.item.crate).contains(aaa.item.bitIndex),