private-attribution / ipa

A raw implementation of Interoperable Private Attribution
MIT License
42 stars 25 forks source link

Potential Perf Opportunity: Remove collect on BTreeMap #1443

Open eriktaubeneck opened 1 week ago

eriktaubeneck commented 1 week ago

I think this refactoring made it less efficient as you now need to collect the intermediates. I didn't think we need that, but you want to have a function, maybe you can make it borrowing from reports and producing an iterator, like this

fn group_report_pairs<'a, BK, V>(
    reports: &'a [PrfHybridReport<BK, V>],
) -> impl Iterator<Item = [AggregateableHybridReport<BK, V>; 2]>> + 'a

_Originally posted by @akoshelev in https://github.com/private-attribution/ipa/pull/1434#discussion_r1843256700_