Skip to content

Pack QueryOrigin memory layout #885

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

Merged

Conversation

ibraheemdev
Copy link
Contributor

Packs QueryOrigin into a (u64, u32, u8) union layout to take advantage of the padding bytes in QueryRevisions. This cuts down the size of memos by two words.

Copy link

netlify bot commented May 29, 2025

Deploy Preview for salsa-rs canceled.

Name Link
🔨 Latest commit 0f178b7
🔍 Latest deploy log https://app.netlify.com/projects/salsa-rs/deploys/6838789a576ede00088e618d

@ibraheemdev ibraheemdev force-pushed the ibraheem/packed-query-origins branch from 275b8ed to 8de13f5 Compare May 29, 2025 14:01
Copy link

codspeed-hq bot commented May 29, 2025

CodSpeed Performance Report

Merging #885 will improve performances by 11.21%

Comparing ibraheemdev:ibraheem/packed-query-origins (0f178b7) with master (40d7844)

Summary

⚡ 1 improvements
✅ 11 untouched benchmarks

Benchmarks breakdown

Benchmark BASE HEAD Change
accumulator 4.4 ms 4 ms +11.21%

let memo_ingredient_index = self.memo_ingredient_index(zalsa, key);
self.get_memo_from_table_for(zalsa, key, memo_ingredient_index)
.map(|m| m.revisions.origin.clone())
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe we were cloning here unnecessarily. Removing this is likely the reason for the accumulator benchmark improvement.

@MichaReiser MichaReiser requested a review from Veykril May 29, 2025 14:18
@ibraheemdev ibraheemdev force-pushed the ibraheem/packed-query-origins branch from 8de13f5 to cc6e38e Compare May 29, 2025 14:46
Copy link
Contributor

@davidbarsky davidbarsky left a comment

Choose a reason for hiding this comment

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

looks good, just some docs feedback and a question about property testing.

/// SAFETY: Same as above.
unsafe impl Sync for QueryOriginData {}

impl QueryOrigin {
Copy link
Contributor

Choose a reason for hiding this comment

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

now, I understand this might be a bit much to ask, but how would you feel about pulling in arbtest (it's my current favorite property testing library...) and generating sequences of method calls in this style? I know the unsafe code is probably fine, but it'd be nice to cut down the amount of "eh, i guess it's fine" unsafe code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not really sure how useful property testing here would be compared to unit tests, but I'm also pretty happy with our current Miri coverage so I don't know if it's worth investing time in. I'm happy to review a PR if you want to add something though :)

Co-authored-by: David Barsky <[email protected]>
@ibraheemdev ibraheemdev force-pushed the ibraheem/packed-query-origins branch from 8a0f4b8 to 0f178b7 Compare May 29, 2025 15:09
@MichaReiser MichaReiser added this pull request to the merge queue May 29, 2025
Merged via the queue into salsa-rs:master with commit 5750c84 May 29, 2025
12 checks passed
@github-actions github-actions bot mentioned this pull request May 29, 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.

4 participants