Closed MusicalNinjaDad closed 3 months ago
This pull request introduces significant performance improvements by changing the return types in the Rust implementation of the FizzBuzz library. The MultiFizzBuzz
trait now returns a lazy rayon::iter::IndexedParallelIterator
, and the FizzBuzz
function returns a FizzBuzzAnswer
enum, which can be converted into a String
or Cow<str>
. The Python implementation has also been updated to work with Rust v4.0.0, resulting in slight performance improvements (approximately 10-20%).
Files | Changes |
---|---|
rust/fizzbuzz/src/lib.rs rust/fizzbuzz/tests/test_numbertypes.rs rust/fizzbuzz/tests/test_multifizzbuzz.rs |
Updated Rust implementation to use new return types for performance improvements and updated corresponding tests. |
rust/fizzbuzzo3/src/lib.rs tests/perf_results.md |
Updated Python wrapper and added performance results for new return types. |
rust/fizzbuzz/benches/bench_fizzbuzz.rs rust/fizzbuzz/benches/bench_sizes.rs |
Updated benchmarks to reflect new return types and added new benchmarks for Cow<str> . |
Attention: Patch coverage is 94.33962%
with 3 lines
in your changes missing coverage. Please review.
Files | Patch % | Lines |
---|---|---|
rust/fizzbuzz/src/lib.rs | 90.62% | 3 Missing :warning: |
:loudspeaker: Thoughts on this report? Let us know!
Rust 4.0.0 & Python 3.0.1
MultiFizzBuzz
now lazily returns a rayon IndexedParallelIteratorFizzBuzz
returns aFizzBuzzAnswer
which can be converted into aString
orCow<str>
FizzBuzzAnswer
now represents the valid answers to FizzBuzz, notOne(String)
orMany(Vec>String>)
Summary by Sourcery
This pull request introduces significant performance improvements by updating the return types for
FizzBuzz
andMultiFizzBuzz
. TheFizzBuzzAnswer
enum has been refactored to directly represent valid FizzBuzz answers. The Python implementation has been updated to work with Rust v4.0.0, bringing slight performance improvements. Documentation and tests have been updated accordingly.FizzBuzz
andMultiFizzBuzz
to improve performance, including lazy evaluation withrayon::iter::IndexedParallelIterator
.FizzBuzzAnswer
to represent valid FizzBuzz answers directly, removing the need forOne(String)
andMany(Vec<String>)
variants.FizzBuzz
andMultiFizzBuzz
.FizzBuzzAnswer
andMultiFizzBuzz
implementations, including tests for negative numbers and non-whole numbers.