-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Remove JSON search file #2552
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove JSON search file #2552
Conversation
f75a6f3
to
1b9f584
Compare
1b9f584
to
88513d8
Compare
Rebased and fixed merge conflict. |
I don't quite understand this PR. Doesn't this introduce the problem of the index loading not being async? Can you provide a little more commentary with the PRs to help explain what they are doing and why, along with some historical information to explain why it is the way it is originally? |
When a script tag is added using the DOM API, it loads asynchronously. Parsing and running blocks the UI thread, but that's true with |
Exactly as @notriddle said. In short: it's doing exactly the same as the JSON loading was doing, except that we skip the JSON part and only keep the JS (because JSON loading doesn't work locally). It remains async though, hence why I needed to add |
I see, thanks! Is it true that the Also, can you also update this: --- a/src/renderer/html_handlebars/search.rs
+++ b/src/renderer/html_handlebars/search.rs
@@ -60,7 +60,7 @@ pub fn create_files(
let index = write_to_json(index, search_config, doc_urls)?;
debug!("Writing search index ✓");
if index.len() > 10_000_000 {
- warn!("searchindex.json is very large ({} bytes)", index.len());
+ warn!("search index is very large ({} bytes)", index.len());
}
if search_config.copy_js { |
I thought I did, gonna remove the remaining ones.
Sure! |
88513d8
to
3cd717f
Compare
3cd717f
to
f54356d
Compare
In the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
That's true, but you should also be aware that parsing JSON is much faster than parsing object literals. Given the size of the index, this is most likely measurable performance regression. Note that this could also be improved by having the |
It's in my TODO list. We had this issue a long time ago in rustdoc. |
Why bother having the search index in both a JSON and JS file when it always work with the JS file after all. :)
I took over #2425 to implement this.
cc @notriddle