Avatar for the salsa-rs user
salsa-rs
salsa
BlogDocsChangelog

Performance History

Latest Results

Avoid checking the TypeId of memos Generally user code cannot touch them; however I need to see the benchmarks to see if this is worth the extra unsafe.
ChayimFriedman2:no-typeid-memo
2 hours ago
Allow customizing the order of memos to save memory usage The order is inferred based on previous runs, like in PGO. In rust-analyzer this saves between 16mb and 100mb on the projects I measured. The setup goes like that: the top level crate, `rust-analyzer`, gains a new feature `precomputed-memo-frequencies`. I also included the following code: ```rust #[macro_export] macro_rules! precomputed_memo_frequencies_path { () => { concat!(env!("CARGO_MANIFEST_DIR"), "/../../memo_frequencies.bin") }; } #[cfg(feature = "precomputed-memo-frequencies")] pub fn memo_frequencies() -> MemoFrequencyStats { static MEMO_FREQUENCIES: std::sync::LazyLock<MemoFrequencyStats> = std::sync::LazyLock::new(|| { let data = include_bytes!(crate::precomputed_memo_frequencies_path!()); MemoFrequencyStats::deserialize(data) }); MEMO_FREQUENCIES.clone() } #[cfg(not(feature = "precomputed-memo-frequencies"))] pub fn memo_frequencies() -> MemoFrequencyStats { MemoFrequencyStats::default() } ``` Then when creating a database I pass `memo_frequencies()`. I also included a flag in the CLI command that analyzes a project (`analysis-stats`). When the flag is active it does: ```rust if let Some(optimal_init_percent) = self.write_memo_frequencies { let memo_freq = MemoFrequencyStats::determine_from_db(db, optimal_init_percent / 100.); let memo_freq = memo_freq.serialize(); let path = crate::precomputed_memo_frequencies_path!(); std::fs::write(path, memo_freq).context("failed to write memo frequency data")?; eprintln!( "Wrote memo frequencies into `{}`.", std::fs::canonicalize(path).unwrap_or_else(|_| PathBuf::from(path)).display(), ); } ``` Then, I first compile without the feature, and run `analysis-stats -- write-memo-frequencies <fraction>` on some project. `<fraction>` is determined experimentally, as a compromise between speed (avoiding excess reallocations) and memory usage; I found 90% (0.9) to be a good balance. After the run finishes, I re-compile with `--features rust-analyzer/precomputed-memo-frequencies`, and now I have an optimized binary.
ChayimFriedman2:freq
1 day ago
Allow customizing the order of memos to save memory usage The order is inferred based on previous runs, like in PGO. In rust-analyzer this saves between 16mb and 100mb on the projects I measured. The setup goes like that: the top level crate, `rust-analyzer`, gains a new feature `precomputed-memo-frequencies`. I also included the following code: ```rust #[macro_export] macro_rules! precomputed_memo_frequencies_path { () => { concat!(env!("CARGO_MANIFEST_DIR"), "/../../memo_frequencies.bin") }; } #[cfg(feature = "precomputed-memo-frequencies")] pub fn memo_frequencies() -> MemoFrequencyStats { static MEMO_FREQUENCIES: std::sync::LazyLock<MemoFrequencyStats> = std::sync::LazyLock::new(|| { let data = include_bytes!(crate::precomputed_memo_frequencies_path!()); MemoFrequencyStats::deserialize(data) }); MEMO_FREQUENCIES.clone() } #[cfg(not(feature = "precomputed-memo-frequencies"))] pub fn memo_frequencies() -> MemoFrequencyStats { MemoFrequencyStats::default() } ``` Then when creating a database I pass `memo_frequencies()`. I also included a flag in the CLI command that analyzes a project (`analysis-stats`). When the flag is active it does: ```rust if let Some(optimal_init_percent) = self.write_memo_frequencies { let memo_freq = MemoFrequencyStats::determine_from_db(db, optimal_init_percent / 100.); let memo_freq = memo_freq.serialize(); let path = crate::precomputed_memo_frequencies_path!(); std::fs::write(path, memo_freq).context("failed to write memo frequency data")?; eprintln!( "Wrote memo frequencies into `{}`.", std::fs::canonicalize(path).unwrap_or_else(|_| PathBuf::from(path)).display(), ); } ``` Then, I first compile without the feature, and run `analysis-stats -- write-memo-frequencies <fraction>` on some project. `<fraction>` is determined experimentally, as a compromise between speed (avoiding excess reallocations) and memory usage; I found 90% (0.9) to be a good balance. After the run finishes, I re-compile with `--features rust-analyzer/precomputed-memo-frequencies`, and now I have an optimized binary.
ChayimFriedman2:freq
1 day ago
chore: Update taiki-e/install-action action to v2.85.13
renovate/taiki-e-install-action-2.x
6 days ago
chore: Update Rust to 1.98
renovate/rust-1.x
6 days ago
fix: simplify query-stack borrowing
MichaReiser:fix-query-stack-reentrancy
8 days ago

Latest Branches

CodSpeed Performance Gauge
-3%
perf: Avoid checking the TypeId of memos#1302
2 hours ago
03054a0
ChayimFriedman2:no-typeid-memo
CodSpeed Performance Gauge
+4%
perf: Allow customizing the order of memos to save memory usage#1301
1 day ago
7ae2499
ChayimFriedman2:freq
CodSpeed Performance Gauge
0%
chore: Update taiki-e/install-action action to v2.85.13#1300
6 days ago
027fbc5
renovate/taiki-e-install-action-2.x
© 2026 CodSpeed Technology
Home Terms Privacy Docs