Repository navigation
perf(tauri-utils): mark parse_json and parse_json5 #[inline] - #16402
Conversation
|
I can't seem to find any meaningful differences between runs on a minimal app, could you share a bit more on how you benchmarked the results? |
Package Changes Through 609ddc5There are 7 changes which include @tauri-apps/api with patch, tauri-bundler with patch, tauri-cli with patch, @tauri-apps/cli with patch, tauri with patch, tauri-runtime-wry with patch, tauri-utils with patch Planned Package VersionsThe following package releases are the planned based on the context of changes in this pull request.
Add another change file through the GitHub UI by following this link. Read about change files or the docs at github.com/jbolda/covector |
|
Those numbers are CPU time for rebuilding tauri-utils on its own, not a whole app: touch The bigger gain comes with the size profile from the docs ( A dev build of the same app takes about 22 s either way, with total CPU going from 141.3 to 138.8 s. Incremental builds don't recompile tauri-utils at all. |
Legend-Master
left a comment
There was a problem hiding this comment.
thanks for explaining, this seems to be safe to add even if the gain's not significant
Closes #16399
config::parse::parse_jsonisn't generic, so every build of tauri-utils generates code for it and for theConfigdeserializer it calls. Nothing in Tauri calls it: tauri-build, tauri-codegen and tauri-cli read the config as aserde_json::Valueand convert it themselves. With#[inline], rustc only generates that code in a crate that calls the function.parse_json5gets the same attribute. Signatures and behavior don't change.Rebuilding just tauri-utils on
devand on this branch (M2 Max, median of 8 interleaved runs, CPU time):devcompression,resources)compression,resources)build-2,compression,resources)The dev rows touch
crates/tauri-utils/src/lib.rsand runcargo build -p tauri-utils --lib --features <features>withCARGO_INCREMENTAL=0. The release row iscargo rustc -p tauri-utils --lib --releasewith the workspace's release profile, which Cargo builds with-C linker-plugin-lto, the same flags an app's copy gets under LTO. This branch was lower in all 8 runs for both app rows and in 7 of 8 for the build scripts. It's CPU on cold builds: incremental builds of an app don't recompile tauri-utils.cargo fmt, the workspace clippy, the tauri-utils tests on 1.90 with all features and with none, andcargo checkof tauri, tauri-build, tauri-codegen, tauri-macros and tauri-cli pass.