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

v2.1: streamline status cache insert (backport of #3365) #3435

Closed
wants to merge 1 commit into from

Conversation

mergify[bot]
Copy link

@mergify mergify bot commented Nov 2, 2024

Problem

  1. There are some redundant operations as part of status cache insert, which is called for every transaction (getting cache entry & setting max slot)
  2. Lacking comments to quickly parse what's happening

Summary of Changes

  1. Pull out a new function, add_to_slot_delta, in the status cache lib for adding a keyslice to a slot delta entry.
  2. Call this new function from fn insert and fn insert_with_slice
  3. Don't call fn insert_with_slice from fn insert
  4. Add some comments to insert to make it easy to follow
    This is an automatic backport of pull request streamline status cache insert #3365 done by Mergify.

@mergify mergify bot requested a review from a team as a code owner November 2, 2024 03:15
@t-nelson
Copy link

t-nelson commented Dec 9, 2024

@bw-solana do we still want this one?

@bw-solana
Copy link

@bw-solana do we still want this one?

I'll need to take a closer look at #3796 to see what @alessandrod did with the status cache to understand how much we care to take this

@alessandrod
Copy link

I'm not planning to backport #3796 so yeah I'd say merge?

(...unless? no lol jk)

@t-nelson
Copy link

what does "streamline" mean here? is this purely cosmetic? why didn't insert_with_slice() get similar treatment?

@bw-solana
Copy link

what does "streamline" mean here? is this purely cosmetic? why didn't insert_with_slice() get similar treatment?

the streamlining is reducing the amount of work done in insert. Specifically, avoiding redundant hashmap entry fetch and setting of max slot:

        let hash_map =
            self.cache
                .entry(*transaction_blockhash)
                .or_insert((slot, key_index, HashMap::new()));
        hash_map.0 = std::cmp::max(slot, hash_map.0);

While in the area, a few cosmetics improvements were made to do things like destructuring tuples, combining lines, adding comments, etc.

I'm happy to make any changes to make this safer, more reviewable, etc. by decoupling functional/cosmetic changes, BPing functional changes only, or making cosmetic improvements to insert_with_slice as well

@t-nelson
Copy link

we agreed to let this one ride on the call, no?

@bw-solana
Copy link

we agreed to let this one ride on the call, no?

I don't remember at all - cache got blown away. I'm fine either way

@t-nelson t-nelson closed this Jan 15, 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.

3 participants