Comments (14)
What search are you referring to? Can you provide a link to an exemplar URL? The site that this repo is for has no search. I suspect you mean https://stdlib.ponylang.io/. If that is the case, the repo for that would be https://github.com/ponylang/mkdocs-theme.
from mkdocs-theme.
You are right, I was talking about search on https://stdlib.ponylang.io/ . Thanks for re-direction. I will open issue there.
from mkdocs-theme.
@gtb no need to open an issue there! I can transfer this one.
from mkdocs-theme.
Chrome 77.0.3865.90
First search is quite slow, subsequent searches are fast.
from mkdocs-theme.
On FF, this is super slow for me for the first search then pokey after that.
On MS Edge Dev, it is slow for first search and snappy after that.
from mkdocs-theme.
MS Edge Dev: 1 sec delay on first search, then snappy.
from mkdocs-theme.
The reason for the slowdown is that the search index to operate on is fetched when the search field is accessed the first time. The code responsible for this is here:
mkdocs-theme/src/assets/javascripts/components/Material/Search/Result.jsx
Lines 132 to 224 in d17f178
https://github.com/ponylang/mkdocs-theme/blob/master/src/assets/javascripts/application.js#L362-L376
It currently fetches the 3.6MB index in json format, parses it and builds the index from it. Those operations are responsible for the delay.
I am not sure we can do much about the general operations necessary for building up the index.
One thing we should look at is to exclude the sources from the search index which should make it significantly smaller and will thus speed up things. And we should make it properly visible that the search is initializing, maybe some spinner or whatever UX element is best for that purpose.
from mkdocs-theme.
Material for MkDocs 5.0.0 has been released. Among other things, it includes:
- Search UI does not freeze anymore (moved to web worker)
- Search index built only once when using instant loading
- Support for prebuilt search indexes
The first two items would probably be enough to solve this issue. If not, we could look into the last one.
This would probably need a squash-and-commit from the changes on upstream after 76d72da until abd2fc3, which would probably break a few things here. It would also break the current docgen -- since there were some breaking changes from version 2.7.1 of this fork up to upstream's 5.0.0 --, so ponyc will require some minor adjustments as well.
from mkdocs-theme.
@EpicEric do you know what would need to change with ponyc's docgen?
from mkdocs-theme.
A small thing we could also do in the meantime is not index the src
directory.
from mkdocs-theme.
This isnt actually a thing mkdocs supports. :(
But there is a plugin that might do what we want: https://github.com/chrieke/mkdocs-exclude-search
from mkdocs-theme.
@SeanTAllen said:
@EpicEric do you know what would need to change with ponyc's docgen?
No, I don't recall what I meant by that.
from mkdocs-theme.
@EpicEric does it only index directories that are in mkdocs.yml?
from mkdocs-theme.
I prebuilt the index for https://ponylang.github.io/appdirs/ and it didn't seem to make a difference.
Is there something extra that needs to be done as far as you know @EpicEric ?
from mkdocs-theme.
Related Issues (5)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mkdocs-theme.