private-attribution / ipa

A raw implementation of Interoperable Private Attribution
MIT License
40 stars 23 forks source link

recursive computation of p and q final without allocation #1134

Closed danielmasny closed 2 months ago

danielmasny commented 2 months ago

verifier.rs computes p and q now recursively without allocation in a vector by using streams and the chunks method on streams

Unfortunately Rust treats streams as different types even when they use the same Item type. I used Pin<Box<Dyn<>> to be able to store different types an accomplish evaluating streams recursively.

I have tried using the chunks method by itertools. Unfortunately, I ran into issues since stream::chunk returns chunks that are vectors, itertools:chunks seems to return a reference to some custom chunk type.

@andyleiserson I think there is probably something that can be improved.

@andyleiserson I did not manage to make your borrow trick work such that I can use streams of owned values or references. The issue is that the Pin<Box<Dyn<Stream>>> became complex, since B = dyn Borrow<[]>

codecov[bot] commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 91.64%. Comparing base (568fc8b) to head (b4478f2). Report is 7 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1134 +/- ## ========================================== + Coverage 91.51% 91.64% +0.13% ========================================== Files 189 190 +1 Lines 27342 27921 +579 ========================================== + Hits 25021 25588 +567 - Misses 2321 2333 +12 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.