Skip to content

perf: avoid clone on serialize frequency items#144

Open
tisonkun wants to merge 2 commits into
mainfrom
avoid-clone
Open

perf: avoid clone on serialize frequency items#144
tisonkun wants to merge 2 commits into
mainfrom
avoid-clone

Conversation

@tisonkun

@tisonkun tisonkun commented Jul 3, 2026

Copy link
Copy Markdown
Member

cc @k3dom

@tisonkun tisonkun requested a review from PsiACE July 3, 2026 18:12
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
@k3dom

k3dom commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Nice, LGTM!

Two small thoughts:

  • active_entries() could probably be a lazy iterator impl Iterator<Item = (&T, u64)> + '_ instead of collecting Vec<(&T, u64)> which would make it totally allocation-free, not sure if it would be always faster though for very large maps.
  • Would probably also make sense to update frequent_items_with_threshold as a follow-up because here we still clone every qualifying item into owned Row's before the caller can filter

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.

2 participants