Closed Owen-CH-Leung closed 1 year ago
I was gonna say I was surprised by the unsafe
use, especially for such time win but ZipSlices is not part of the itertools library, it's only part of benches.
Ahh yesss I misread. I thought it's under src
when I was revising it. Thanks both for your comments. I'll continue to see if custom fold
can be implemented in other iterators
As per discussion in #755 , this PR implements custom
fold
logic forZipSlices<T, U>
and create benchmark test to measure the performance gain compared with the defaultfold
.Running the
zipdot i32 zipslices fold
benchmark using the defaultfold
logic, the time wastime: [42.749 ns 43.163 ns 43.782 ns]
Running the
zipdot i32 zipslices fold
benchmark using the customfold
logic, the time wastime: [42.523 ns 42.621 ns 42.737 ns]