salsa-rs / salsa

A generic framework for on-demand, incrementalized computation. Inspired by adapton, glimmer, and rustc's query system.
https://salsa-rs.netlify.app/
Apache License 2.0
2.13k stars 152 forks source link

Add benchmark for query with many tracked structs #529

Closed MichaReiser closed 3 months ago

MichaReiser commented 3 months ago

This PR adds a micro-benchmark that measures the cost of validating many tracked structs that are all unaffected by the input change.

The benchmark is emulating a scenario where a root query creates a large number of tracked structs, e.g., a program.check call. Now, a single file changes that invalidates a very small subset of ingredients, but program.check still pays the cost of marking unchanged ingredients as "validated".

Testing

I back-ported the benchmark to before beautiful Salsa. See https://github.com/salsa-rs/salsa/pull/530.

Running the benchmark on the current version takes around 14us whereas the pre-rewrite version only takes 12us on my machine.

This benchmark covers https://salsa.zulipchat.com/#narrow/stream/333573-salsa-3.2E0/topic/Beautiful.20Salsa.20perf.20incremental.20checking.20perf.20regression

netlify[bot] commented 3 months ago

Deploy Preview for salsa-rs canceled.

Name Link
Latest commit fc0a82bd10abdbcc5635309db85dc5776bd5f5b3
Latest deploy log https://app.netlify.com/sites/salsa-rs/deploys/66a36fb4f896d40009c03a07