docfx icon indicating copy to clipboard operation
docfx copied to clipboard

search within ~10 seconds of page load is very slow

Open lidermanrony opened this issue 6 years ago • 7 comments

Operation System: (Windows or Linux or MacOS) Windows DocFX Version Used: All of them Template used: (default or statictoc or contain custom template) default Steps to Reproduce:

  1. browse to https://aka.ms/kusto
  2. any search within the ~10 seconds of page load will return only after 10 seconds passed from time page loads.

Expected Behavior: wait less than a second. This is very common in documentation websites to load the page and the immediately search. Actual Behavior: wait for more than 10 seconds

Looks like the issue is that lunr.js is building the index on-the-fly on page-load in a search-worker.js. but this is a static website - the index can be persisted and then just loaded instead of building an index every time.

here is documentation on that from lunr.js website on how to use pre-build indexes.

lidermanrony avatar Jun 17 '19 22:06 lidermanrony

+1

sloutsky avatar Jun 18 '19 04:06 sloutsky

Just to clarify, this slowness doesn't seem to be during the first search per se, but rather during the first ~8 seconds after each page load. So a more exact repro would be: Any searches within ~8 seconds of page load will be incredibly slow, lasting up to ~8 seconds, and any searches after that will be fast.

jruales avatar Jun 21 '19 20:06 jruales

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in a week if no further activity occurs.

stale[bot] avatar Sep 19 '19 21:09 stale[bot]

Any update on this issue?

jruales avatar Sep 19 '19 21:09 jruales

Sorry for the late reply. Looks like prebuild index can help. Although the index could be large that slows down the first lunch, it should improve the following searching.

superyyrrzz avatar Sep 20 '19 02:09 superyyrrzz

This issue is also affecting the internal Geneva documentation (https://genevamondocs.azurewebsites.net/), where the search feature can take >30 seconds to start working after any page load

jruales avatar Mar 11 '20 20:03 jruales

Added a browser cache to speed up page load speed for subsequent visits. The first page view still builds the index in the browser and is slow.

yufeih avatar Oct 04 '23 04:10 yufeih