Skip to content

Conversation

@gvozdvmozgu
Copy link
Contributor

close #1026

@netlify
Copy link

netlify bot commented Nov 20, 2025

Deploy Preview for salsa-rs canceled.

Name Link
🔨 Latest commit 80cae02
🔍 Latest deploy log https://app.netlify.com/projects/salsa-rs/deploys/691f5477b548e100089bf8ed

@codspeed-hq
Copy link

codspeed-hq bot commented Nov 20, 2025

CodSpeed Performance Report

Merging #1027 will improve performances by 5.73%

Comparing gvozdvmozgu:interned-enums (80cae02) with master (a885bb4)

Summary

⚡ 2 improvements
✅ 11 untouched

Benchmarks breakdown

Benchmark BASE HEAD Change
amortized[InternedInput] 2.2 µs 2 µs +5.73%
new[InternedInput] 4.5 µs 4.3 µs +4.8%

Copy link
Contributor

@MichaReiser MichaReiser left a comment

Choose a reason for hiding this comment

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

Thank you for working on this.

Ok(crate::debug::dump_tokens(
struct_ident,
quote! {
#(#additional_items)*
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not a 100% sure whether this is possible but I think it should be.

Could we move the synthesized struct definition within the const _: () => { block. It has the advantage that we can auto generate a name for the interned struct

https://github.com/MichaReiser/salsa/blob/0c64a1a99aeb0986b951eb7b1367dac5b1fbb32f/components/salsa-macro-rules/src/setup_interned_struct.rs#L101-L103

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add or extend an existing persistence test to show that persistence works with interned enums too

https://github.com/MichaReiser/salsa/blob/0c64a1a99aeb0986b951eb7b1367dac5b1fbb32f/tests/persistence.rs#L4

Copy link
Contributor

@MichaReiser MichaReiser left a comment

Choose a reason for hiding this comment

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

Hmm, thinking more about this, I don't think this will work, or at least, would be very confusing.

Up to now, a one-argument query can take any salsa-struct (interned, input, or tracked). With this change, this would no longer be the case for interned enums because they don't implement AsId (they can't, they don't know the ID).

I'll close this PR (and the issue) for now as I'm no longer convinced we want this feature. Thanks for giving it a try, it helped me understand why this isn't what we need

@MichaReiser MichaReiser mentioned this pull request Nov 21, 2025
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.

enum interning

2 participants