-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Replace big JS dict with JSON parsing #71250
Conversation
Nice! This is huge for embedded crates! |
d61dd67
to
b4fb306
Compare
It would be nice if this could include a statement of the schema of the index, that way |
It's the same as before. But if you the schema anyway, I can send it to you? |
Having it formally stated would be good. Parsing JSON in rustup is plausible, where running arbitrary javascript was not :D |
Cool!However, is possible to minify the Json search index to reduce the file size? |
No. That's something I've been working on for a long time and I was able to get some improvements, but nothing extraordinary. The best we can do for the moment is compressing the result (which I expect is done by the users wanting to host their own doc). |
Google Chrome team gives an awesome video to explain why the |
Inspired by rust-lang/rust#71250. In short, it's a lot faster to parse. Because our index is roughly 1MB, this may help speed up the initial page load.
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.
I'm sad that we're not adding a searchIndex.json file and then loading that in searchIndex.js but I can understand the goal of simplicity.
Would it be possible to have the JSON as a separate file?
Also, doesn't the compiler have serde these days? If so, should we consider filing a help-wanted to convert this into serde code to make it less string-faffy in the future (not for this PR) ?
I'm content with it as-is, though I'd prefer to see the JSON as a separate file if that's not a huge amount of work. @GuillaumeGomez Have a ponder over my points in the review, and if you feel things are OK enough as-is, or that splitting the JSON into a separate file is too hard for now, then you have r=me. |
@kinnison As I know, if we use search-index.json, then we need an extra step to load the JSON file via HTTP request, which brings no efficient, even worse than the current implementation. |
That load could be deliberately done as an asynchronous operation, enabling the search box only when the load is complete, and that means the actual usable page load could be faster; but as I said, I'm happy if that doesn't happen in this PR. |
This is what I tried at first, but you can't load a JSON file locally because of security concerns, meaning that we'd need an HTTP server when using local docs, which I'm strongly opposed to. So unfortunately, we're still forced to keep the JSON as a string in the same file... Also, the problem here isn't the download of the file but the JS parsing (which is now kinda solved since there is almost no JS). |
📌 Commit b4fb306 has been approved by |
💡 This pull request was already approved, no need to approve it again.
|
📌 Commit b4fb306 has been approved by |
⌛ Testing commit b4fb306 with merge aeeae8925dcc1f8a1bb0062efd5d9ba61afd856a... |
…js, r=kinnison Replace big JS dict with JSON parsing Part of rust-lang#56545. @ollie27 suggested that using JSON instead of a JS dict might be faster, so I decided to test it. And the results far exceeded whatever expectations I had... I used https://github.com/adamgreig/stm32ral for my tests. If you want to build it locally: ```bash $ cargo doc --features doc --open ``` But I strongly recommend to do it with this PR. Some numbers: * Loading a page with the JSON search-index: less than 1 second * Loading a page with the JS search-index: crashed after 30 seconds I think the results are clear enough... r? @ollie27 cc @rust-lang/rustdoc
@bors retry (included in rollup) |
…js, r=kinnison Replace big JS dict with JSON parsing Part of rust-lang#56545. @ollie27 suggested that using JSON instead of a JS dict might be faster, so I decided to test it. And the results far exceeded whatever expectations I had... I used https://github.com/adamgreig/stm32ral for my tests. If you want to build it locally: ```bash $ cargo doc --features doc --open ``` But I strongly recommend to do it with this PR. Some numbers: * Loading a page with the JSON search-index: less than 1 second * Loading a page with the JS search-index: crashed after 30 seconds I think the results are clear enough... r? @ollie27 cc @rust-lang/rustdoc
…js, r=kinnison Replace big JS dict with JSON parsing Part of rust-lang#56545. @ollie27 suggested that using JSON instead of a JS dict might be faster, so I decided to test it. And the results far exceeded whatever expectations I had... I used https://github.com/adamgreig/stm32ral for my tests. If you want to build it locally: ```bash $ cargo doc --features doc --open ``` But I strongly recommend to do it with this PR. Some numbers: * Loading a page with the JSON search-index: less than 1 second * Loading a page with the JS search-index: crashed after 30 seconds I think the results are clear enough... r? @ollie27 cc @rust-lang/rustdoc
Rollup of 5 pull requests Successful merges: - rust-lang#71250 (Replace big JS dict with JSON parsing) - rust-lang#71270 (Fix `has_no_input_arg` check and rename it to `has_only_self_parameter`) - rust-lang#71284 (fix -Zast-json to output correct JSON form) - rust-lang#71328 (Stabilize PathBuf capacity methods) - rust-lang#71334 (Update pattern docs.) Failed merges: r? @ghost
☔ The latest upstream changes (presumably #71356) made this pull request unmergeable. Please resolve the merge conflicts. |
This comment has been minimized.
This comment has been minimized.
Pkgsrc changes: * Remove a couple diffs which are now integrated upstream. * Adjust cargo checksums after upstream upgrades. * Belatedly bump the curl dependency * Unset DESTDIR during the build phase, to work around a mysterious build bug deep in the bowels of llvm. * Bump nearly all bootstraps to 1.43.1. Upstream changes: Version 1.44.0 (2020-06-04) ========================== Language -------- - [You can now use `async/.await` with `#[no_std]` enabled.][69033] - [Added the `unused_braces` lint.][70081] **Syntax-only changes** - [Expansion-driven outline module parsing][69838] ```rust #[cfg(FALSE)] mod foo { mod bar { mod baz; // `foo/bar/baz.rs` doesn't exist, but no error! } } ``` These are still rejected semantically, so you will likely receive an error but these changes can be seen and parsed by macros and conditional compilation. Compiler -------- - [Rustc now respects the `-C codegen-units` flag in incremental mode.][70156] Additionally when in incremental mode rustc defaults to 256 codegen units. - [Refactored `catch_unwind`, to have zero-cost unless unwinding is enabled and a panic is thrown.][67502] - [Added tier 3\* support for the `aarch64-unknown-none` and `aarch64-unknown-none-softfloat` targets.][68334] - [Added tier 3 support for `arm64-apple-tvos` and `x86_64-apple-tvos` targets.][68191] Libraries --------- - [Special cased `vec![]` to map directly to `Vec::new()`.][70632] This allows `vec![]` to be able to be used in `const` contexts. - [`convert::Infallible` now implements `Hash`.][70281] - [`OsString` now implements `DerefMut` and `IndexMut` returning a `&mut OsStr`.][70048] - [Unicode 13 is now supported.][69929] - [`String` now implements `From<&mut str>`.][69661] - [`IoSlice` now implements `Copy`.][69403] - [`Vec<T>` now implements `From<[T; N]>`.][68692] Where `N` is less than 32. - [`proc_macro::LexError` now implements `fmt::Display` and `Error`.][68899] - [`from_le_bytes`, `to_le_bytes`, `from_be_bytes`, `to_be_bytes`, `from_ne_bytes`, and `to_ne_bytes` methods are now `const` for all integer types.][69373] Stabilized APIs --------------- - [`PathBuf::with_capacity`] - [`PathBuf::capacity`] - [`PathBuf::clear`] - [`PathBuf::reserve`] - [`PathBuf::reserve_exact`] - [`PathBuf::shrink_to_fit`] - [`f32::to_int_unchecked`] - [`f64::to_int_unchecked`] - [`Layout::align_to`] - [`Layout::pad_to_align`] - [`Layout::array`] - [`Layout::extend`] Cargo ----- - [Added the `cargo tree` command which will print a tree graph of your dependencies.][cargo/8062] E.g. ``` mdbook v0.3.2 (/Users/src/rust/mdbook) +-- ammonia v3.0.0 | +-- html5ever v0.24.0 | | +-- log v0.4.8 | | | +-- cfg-if v0.1.9 | | +-- mac v0.1.1 | | +-- markup5ever v0.9.0 | | +-- log v0.4.8 (*) | | +-- phf v0.7.24 | | | +-- phf_shared v0.7.24 | | | +-- siphasher v0.2.3 | | | +-- unicase v1.4.2 | | | [build-dependencies] | | | +-- version_check v0.1.5 ... ``` You can also display dependencies on multiple versions of the same crate with `cargo tree -d` (short for `cargo tree --duplicates`). Misc ---- - [Rustdoc now allows you to specify `--crate-version` to have rustdoc include the version in the sidebar.][69494] Compatibility Notes ------------------- - [Rustc now correctly generates static libraries on Windows GNU targets with the `.a` extension, rather than the previous `.lib`.][70937] - [Removed the `-C no_integrated_as` flag from rustc.][70345] - [The `file_name` property in JSON output of macro errors now points the actual source file rather than the previous format of `<NAME macros>`.][70969] **Note:** this may not point a file that actually exists on the user's system. - [The minimum required external LLVM version has been bumped to LLVM 8.][71147] - [`mem::{zeroed, uninitialised}` will now panic when used with types that do not allow zero initialization such as `NonZeroU8`.][66059] This was previously a warning. - [In 1.45.0 (the next release) converting a `f64` to `u32` using the `as` operator has been defined as a saturating operation.][71269] This was previously undefined behaviour, you can use the `{f64, f32}::to_int_unchecked` methods to continue using the current behaviour which may desirable in rare performance sensitive situations. Internal Only ------------- These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools. - [dep_graph Avoid allocating a set on when the number reads are small.][69778] - [Replace big JS dict with JSON parsing.][71250] [69373]: rust-lang/rust#69373 [66059]: rust-lang/rust#66059 [68191]: rust-lang/rust#68191 [68899]: rust-lang/rust#68899 [71147]: rust-lang/rust#71147 [71250]: rust-lang/rust#71250 [70937]: rust-lang/rust#70937 [70969]: rust-lang/rust#70969 [70632]: rust-lang/rust#70632 [70281]: rust-lang/rust#70281 [70345]: rust-lang/rust#70345 [70048]: rust-lang/rust#70048 [70081]: rust-lang/rust#70081 [70156]: rust-lang/rust#70156 [71269]: rust-lang/rust#71269 [69838]: rust-lang/rust#69838 [69929]: rust-lang/rust#69929 [69661]: rust-lang/rust#69661 [69778]: rust-lang/rust#69778 [69494]: rust-lang/rust#69494 [69403]: rust-lang/rust#69403 [69033]: rust-lang/rust#69033 [68692]: rust-lang/rust#68692 [68334]: rust-lang/rust#68334 [67502]: rust-lang/rust#67502 [cargo/8062]: rust-lang/cargo#8062 [`PathBuf::with_capacity`]: https://doc.rust-lang.org/std/path/struct.PathBuf.html#method.with_capacity [`PathBuf::capacity`]: https://doc.rust-lang.org/std/path/struct.PathBuf.html#method.capacity [`PathBuf::clear`]: https://doc.rust-lang.org/std/path/struct.PathBuf.html#method.clear [`PathBuf::reserve`]: https://doc.rust-lang.org/std/path/struct.PathBuf.html#method.reserve [`PathBuf::reserve_exact`]: https://doc.rust-lang.org/std/path/struct.PathBuf.html#method.reserve_exact [`PathBuf::shrink_to_fit`]: https://doc.rust-lang.org/std/path/struct.PathBuf.html#method.shrink_to_fit [`f32::to_int_unchecked`]: https://doc.rust-lang.org/std/primitive.f32.html#method.to_int_unchecked [`f64::to_int_unchecked`]: https://doc.rust-lang.org/std/primitive.f64.html#method.to_int_unchecked [`Layout::align_to`]: https://doc.rust-lang.org/std/alloc/struct.Layout.html#method.align_to [`Layout::pad_to_align`]: https://doc.rust-lang.org/std/alloc/struct.Layout.html#method.pad_to_align [`Layout::array`]: https://doc.rust-lang.org/std/alloc/struct.Layout.html#method.array [`Layout::extend`]: https://doc.rust-lang.org/std/alloc/struct.Layout.html#method.extend
Version 1.44.0 (2020-06-04) ========================== Language -------- - [You can now use `async/.await` with `#[no_std]` enabled.][69033] - [Added the `unused_braces` lint.][70081] **Syntax-only changes** - [Expansion-driven outline module parsing][69838] ```rust #[cfg(FALSE)] mod foo { mod bar { mod baz; // `foo/bar/baz.rs` doesn't exist, but no error! } } ``` These are still rejected semantically, so you will likely receive an error but these changes can be seen and parsed by macros and conditional compilation. Compiler -------- - [Rustc now respects the `-C codegen-units` flag in incremental mode.][70156] Additionally when in incremental mode rustc defaults to 256 codegen units. - [Refactored `catch_unwind` to have zero-cost, unless unwinding is enabled and a panic is thrown.][67502] - [Added tier 3\* support for the `aarch64-unknown-none` and `aarch64-unknown-none-softfloat` targets.][68334] - [Added tier 3 support for `arm64-apple-tvos` and `x86_64-apple-tvos` targets.][68191] Libraries --------- - [Special cased `vec![]` to map directly to `Vec::new()`.][70632] This allows `vec![]` to be able to be used in `const` contexts. - [`convert::Infallible` now implements `Hash`.][70281] - [`OsString` now implements `DerefMut` and `IndexMut` returning a `&mut OsStr`.][70048] - [Unicode 13 is now supported.][69929] - [`String` now implements `From<&mut str>`.][69661] - [`IoSlice` now implements `Copy`.][69403] - [`Vec<T>` now implements `From<[T; N]>`.][68692] Where `N` is at most 32. - [`proc_macro::LexError` now implements `fmt::Display` and `Error`.][68899] - [`from_le_bytes`, `to_le_bytes`, `from_be_bytes`, `to_be_bytes`, `from_ne_bytes`, and `to_ne_bytes` methods are now `const` for all integer types.][69373] Stabilized APIs --------------- - [`PathBuf::with_capacity`] - [`PathBuf::capacity`] - [`PathBuf::clear`] - [`PathBuf::reserve`] - [`PathBuf::reserve_exact`] - [`PathBuf::shrink_to_fit`] - [`f32::to_int_unchecked`] - [`f64::to_int_unchecked`] - [`Layout::align_to`] - [`Layout::pad_to_align`] - [`Layout::array`] - [`Layout::extend`] Cargo ----- - [Added the `cargo tree` command which will print a tree graph of your dependencies.][cargo/8062] E.g. ``` mdbook v0.3.2 (/Users/src/rust/mdbook) ├── ammonia v3.0.0 │ ├── html5ever v0.24.0 │ │ ├── log v0.4.8 │ │ │ └── cfg-if v0.1.9 │ │ ├── mac v0.1.1 │ │ └── markup5ever v0.9.0 │ │ ├── log v0.4.8 (*) │ │ ├── phf v0.7.24 │ │ │ └── phf_shared v0.7.24 │ │ │ ├── siphasher v0.2.3 │ │ │ └── unicase v1.4.2 │ │ │ [build-dependencies] │ │ │ └── version_check v0.1.5 ... ``` You can also display dependencies on multiple versions of the same crate with `cargo tree -d` (short for `cargo tree --duplicates`). Misc ---- - [Rustdoc now allows you to specify `--crate-version` to have rustdoc include the version in the sidebar.][69494] Compatibility Notes ------------------- - [Rustc now correctly generates static libraries on Windows GNU targets with the `.a` extension, rather than the previous `.lib`.][70937] - [Removed the `-C no_integrated_as` flag from rustc.][70345] - [The `file_name` property in JSON output of macro errors now points the actual source file rather than the previous format of `<NAME macros>`.][70969] **Note:** this may not point to a file that actually exists on the user's system. - [The minimum required external LLVM version has been bumped to LLVM 8.][71147] - [`mem::{zeroed, uninitialised}` will now panic when used with types that do not allow zero initialization such as `NonZeroU8`.][66059] This was previously a warning. - [In 1.45.0 (the next release) converting a `f64` to `u32` using the `as` operator has been defined as a saturating operation.][71269] This was previously undefined behaviour, but you can use the `{f64, f32}::to_int_unchecked` methods to continue using the current behaviour, which may be desirable in rare performance sensitive situations. Internal Only ------------- These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools. - [dep_graph Avoid allocating a set on when the number reads are small.][69778] - [Replace big JS dict with JSON parsing.][71250] [69373]: rust-lang/rust#69373 [66059]: rust-lang/rust#66059 [68191]: rust-lang/rust#68191 [68899]: rust-lang/rust#68899 [71147]: rust-lang/rust#71147 [71250]: rust-lang/rust#71250 [70937]: rust-lang/rust#70937 [70969]: rust-lang/rust#70969 [70632]: rust-lang/rust#70632 [70281]: rust-lang/rust#70281 [70345]: rust-lang/rust#70345 [70048]: rust-lang/rust#70048 [70081]: rust-lang/rust#70081 [70156]: rust-lang/rust#70156 [71269]: rust-lang/rust#71269 [69838]: rust-lang/rust#69838 [69929]: rust-lang/rust#69929 [69661]: rust-lang/rust#69661 [69778]: rust-lang/rust#69778 [69494]: rust-lang/rust#69494 [69403]: rust-lang/rust#69403 [69033]: rust-lang/rust#69033 [68692]: rust-lang/rust#68692 [68334]: rust-lang/rust#68334 [67502]: rust-lang/rust#67502 [cargo/8062]: rust-lang/cargo#8062 [`PathBuf::with_capacity`]: https://doc.rust-lang.org/std/path/struct.PathBuf.html#method.with_capacity [`PathBuf::capacity`]: https://doc.rust-lang.org/std/path/struct.PathBuf.html#method.capacity [`PathBuf::clear`]: https://doc.rust-lang.org/std/path/struct.PathBuf.html#method.clear [`PathBuf::reserve`]: https://doc.rust-lang.org/std/path/struct.PathBuf.html#method.reserve [`PathBuf::reserve_exact`]: https://doc.rust-lang.org/std/path/struct.PathBuf.html#method.reserve_exact [`PathBuf::shrink_to_fit`]: https://doc.rust-lang.org/std/path/struct.PathBuf.html#method.shrink_to_fit [`f32::to_int_unchecked`]: https://doc.rust-lang.org/std/primitive.f32.html#method.to_int_unchecked [`f64::to_int_unchecked`]: https://doc.rust-lang.org/std/primitive.f64.html#method.to_int_unchecked [`Layout::align_to`]: https://doc.rust-lang.org/std/alloc/struct.Layout.html#method.align_to [`Layout::pad_to_align`]: https://doc.rust-lang.org/std/alloc/struct.Layout.html#method.pad_to_align [`Layout::array`]: https://doc.rust-lang.org/std/alloc/struct.Layout.html#method.array [`Layout::extend`]: https://doc.rust-lang.org/std/alloc/struct.Layout.html#method.extend
@alecmocatta JSONP isn't really a solution, as it brings the problem we are trying to avoid in the first place - embedding data in script context. Still, the search isn't immediately required on load (user likely won't interact with it withing first second anyway), so time to first paint could still be improved by not waiting on it. Possible solution might involve |
@Frizi Sorry, I was misinterpreting a comment upthread. I was meaning storing the search index as a file like: callback(JSON.parse("{...}")) which it turns out is exactly what this PR is doing! |
@Frizi If you load a page with search query in the URL, search will kick in pretty early (but I'm nitpicking here :p). @alecmocatta: Yes absolutely. Glad to see we're on the same page! |
Pkgsrc changes: * Remove the clutter caused by the cross-compile setup from Makefile (Now consigned to my own private cross.mk file.) * Remove a couple of patches which are now integrated upstream. * Minor adjustments to a couple of other patches. * Adjust cargo checksums after upstream upgrades. * Belatedly bump the curl dependency * If doing a "dist" build, unset DESTDIR during the build phase, to work around a mysterious build bug deep in the bowels of llvm, causing llvm tools to be installed to a directory unexpecetd by the rest of the rust build, ref. rust-lang/rust#73132 A "dist" build is not expected to be followed by an "install". * Bump nearly all bootstraps to 1.43.1; NetBSD earmv7hf bootstrap bumped to 1.44.0, as that one now finally builds and works. Upstream changes: Version 1.44.0 (2020-06-04) ========================== Language -------- - [You can now use `async/.await` with `#[no_std]` enabled.][69033] - [Added the `unused_braces` lint.][70081] **Syntax-only changes** - [Expansion-driven outline module parsing][69838] ```rust #[cfg(FALSE)] mod foo { mod bar { mod baz; // `foo/bar/baz.rs` doesn't exist, but no error! } } ``` These are still rejected semantically, so you will likely receive an error but these changes can be seen and parsed by macros and conditional compilation. Compiler -------- - [Rustc now respects the `-C codegen-units` flag in incremental mode.][70156] Additionally when in incremental mode rustc defaults to 256 codegen units. - [Refactored `catch_unwind`, to have zero-cost unless unwinding is enabled and a panic is thrown.][67502] - [Added tier 3\* support for the `aarch64-unknown-none` and `aarch64-unknown-none-softfloat` targets.][68334] - [Added tier 3 support for `arm64-apple-tvos` and `x86_64-apple-tvos` targets.][68191] Libraries --------- - [Special cased `vec![]` to map directly to `Vec::new()`.][70632] This allows `vec![]` to be able to be used in `const` contexts. - [`convert::Infallible` now implements `Hash`.][70281] - [`OsString` now implements `DerefMut` and `IndexMut` returning a `&mut OsStr`.][70048] - [Unicode 13 is now supported.][69929] - [`String` now implements `From<&mut str>`.][69661] - [`IoSlice` now implements `Copy`.][69403] - [`Vec<T>` now implements `From<[T; N]>`.][68692] Where `N` is less than 32. - [`proc_macro::LexError` now implements `fmt::Display` and `Error`.][68899] - [`from_le_bytes`, `to_le_bytes`, `from_be_bytes`, `to_be_bytes`, `from_ne_bytes`, and `to_ne_bytes` methods are now `const` for all integer types.][69373] Stabilized APIs --------------- - [`PathBuf::with_capacity`] - [`PathBuf::capacity`] - [`PathBuf::clear`] - [`PathBuf::reserve`] - [`PathBuf::reserve_exact`] - [`PathBuf::shrink_to_fit`] - [`f32::to_int_unchecked`] - [`f64::to_int_unchecked`] - [`Layout::align_to`] - [`Layout::pad_to_align`] - [`Layout::array`] - [`Layout::extend`] Cargo ----- - [Added the `cargo tree` command which will print a tree graph of your dependencies.][cargo/8062] E.g. ``` mdbook v0.3.2 (/Users/src/rust/mdbook) +-- ammonia v3.0.0 | +-- html5ever v0.24.0 | | +-- log v0.4.8 | | | +-- cfg-if v0.1.9 | | +-- mac v0.1.1 | | +-- markup5ever v0.9.0 | | +-- log v0.4.8 (*) | | +-- phf v0.7.24 | | | +-- phf_shared v0.7.24 | | | +-- siphasher v0.2.3 | | | +-- unicase v1.4.2 | | | [build-dependencies] | | | +-- version_check v0.1.5 ... ``` You can also display dependencies on multiple versions of the same crate with `cargo tree -d` (short for `cargo tree --duplicates`). Misc ---- - [Rustdoc now allows you to specify `--crate-version` to have rustdoc include the version in the sidebar.][69494] Compatibility Notes ------------------- - [Rustc now correctly generates static libraries on Windows GNU targets with the `.a` extension, rather than the previous `.lib`.][70937] - [Removed the `-C no_integrated_as` flag from rustc.][70345] - [The `file_name` property in JSON output of macro errors now points the actual source file rather than the previous format of `<NAME macros>`.][70969] **Note:** this may not point a file that actually exists on the user's system. - [The minimum required external LLVM version has been bumped to LLVM 8.][71147] - [`mem::{zeroed, uninitialised}` will now panic when used with types that do not allow zero initialization such as `NonZeroU8`.][66059] This was previously a warning. - [In 1.45.0 (the next release) converting a `f64` to `u32` using the `as` operator has been defined as a saturating operation.][71269] This was previously undefined behaviour, you can use the `{f64, f32}::to_int_unchecked` methods to continue using the current behaviour which may desirable in rare performance sensitive situations. Internal Only ------------- These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools. - [dep_graph Avoid allocating a set on when the number reads are small.][69778] - [Replace big JS dict with JSON parsing.][71250] [69373]: rust-lang/rust#69373 [66059]: rust-lang/rust#66059 [68191]: rust-lang/rust#68191 [68899]: rust-lang/rust#68899 [71147]: rust-lang/rust#71147 [71250]: rust-lang/rust#71250 [70937]: rust-lang/rust#70937 [70969]: rust-lang/rust#70969 [70632]: rust-lang/rust#70632 [70281]: rust-lang/rust#70281 [70345]: rust-lang/rust#70345 [70048]: rust-lang/rust#70048 [70081]: rust-lang/rust#70081 [70156]: rust-lang/rust#70156 [71269]: rust-lang/rust#71269 [69838]: rust-lang/rust#69838 [69929]: rust-lang/rust#69929 [69661]: rust-lang/rust#69661 [69778]: rust-lang/rust#69778 [69494]: rust-lang/rust#69494 [69403]: rust-lang/rust#69403 [69033]: rust-lang/rust#69033 [68692]: rust-lang/rust#68692 [68334]: rust-lang/rust#68334 [67502]: rust-lang/rust#67502 [cargo/8062]: rust-lang/cargo#8062 [`PathBuf::with_capacity`]: https://doc.rust-lang.org/std/path/struct.PathBuf.html#method.with_capacity [`PathBuf::capacity`]: https://doc.rust-lang.org/std/path/struct.PathBuf.html#method.capacity [`PathBuf::clear`]: https://doc.rust-lang.org/std/path/struct.PathBuf.html#method.clear [`PathBuf::reserve`]: https://doc.rust-lang.org/std/path/struct.PathBuf.html#method.reserve [`PathBuf::reserve_exact`]: https://doc.rust-lang.org/std/path/struct.PathBuf.html#method.reserve_exact [`PathBuf::shrink_to_fit`]: https://doc.rust-lang.org/std/path/struct.PathBuf.html#method.shrink_to_fit [`f32::to_int_unchecked`]: https://doc.rust-lang.org/std/primitive.f32.html#method.to_int_unchecked [`f64::to_int_unchecked`]: https://doc.rust-lang.org/std/primitive.f64.html#method.to_int_unchecked [`Layout::align_to`]: https://doc.rust-lang.org/std/alloc/struct.Layout.html#method.align_to [`Layout::pad_to_align`]: https://doc.rust-lang.org/std/alloc/struct.Layout.html#method.pad_to_align [`Layout::array`]: https://doc.rust-lang.org/std/alloc/struct.Layout.html#method.array [`Layout::extend`]: https://doc.rust-lang.org/std/alloc/struct.Layout.html#method.extend
Part of #56545.
@ollie27 suggested that using JSON instead of a JS dict might be faster, so I decided to test it. And the results far exceeded whatever expectations I had...
I used https://github.com/adamgreig/stm32ral for my tests. If you want to build it locally:
But I strongly recommend to do it with this PR. Some numbers:
I think the results are clear enough...
r? @ollie27
cc @rust-lang/rustdoc