Skip to content
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

Have salsa not depend on salsa-macros #750

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Veykril
Copy link
Member

@Veykril Veykril commented Mar 8, 2025

That way salsa can build without having to build the proc-macro ecosystem, improving build times for dependants of salsa

Copy link

netlify bot commented Mar 8, 2025

Deploy Preview for salsa-rs canceled.

Name Link
🔨 Latest commit fa8c391
🔍 Latest deploy log https://app.netlify.com/sites/salsa-rs/deploys/67cc141f699d780008fd7785

Comment on lines +91 to +105

#[doc(hidden)]
fn zalsa_register_downcaster(&self) {
// The no-op downcaster is special cased in view caster construction.
}

#[doc(hidden)]
#[inline(always)]
unsafe fn downcast(db: &dyn Database) -> &dyn Database
where
Self: Sized,
{
// No-op
db
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interestingly enough, this change also means that one does not actually need to use #[salsa::db] on trait impls for the baseline Database

Copy link

codspeed-hq bot commented Mar 8, 2025

CodSpeed Performance Report

Merging #750 will improve performances by 8.52%

Comparing Veykril:veykril/push-szqzqmmrqqxt (fa8c391) with master (dbb0e5f)

Summary

⚡ 4 improvements
✅ 7 untouched benchmarks

Benchmarks breakdown

Benchmark BASE HEAD Change
amortized[Input] 3.7 µs 3.5 µs +7.31%
amortized[InternedInput] 3.6 µs 3.3 µs +8.52%
amortized[SupertypeInput] 4.5 µs 4.2 µs +7.85%
new[InternedInput] 5.4 µs 5 µs +6.16%

That way salsa can build without having to build the proc-macro ecosystem, improving build times for dependants of salsa
@Veykril Veykril force-pushed the veykril/push-szqzqmmrqqxt branch from e13f1d3 to fa8c391 Compare March 8, 2025 09:55
Comment on lines +92 to +95
#[doc(hidden)]
fn zalsa_register_downcaster(&self) {
// The no-op downcaster is special cased in view caster construction.
}
Copy link
Member Author

@Veykril Veykril Mar 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The perf changes come from this being a no-op now, so they are kind of fake as you only get that benefit if you don't use a custom database trait, and more importantly, you only really hit this when the ingredient cache fails which in a usual setup with a single database is no the case (our benches create a bunch of databases making the ingredient cache useless for them)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant