-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Performance improvements - new return types in rust (#57)
## Rust 4.0.0 & Python 3.0.1 - **BREAKING CHANGES - Rust**: new return types for significant performance improvements: - `MultiFizzBuzz` now lazily returns a rayon IndexedParallelIterator - `FizzBuzz` returns a `FizzBuzzAnswer` which can be converted into a `String` or `Cow<str>` - `FizzBuzzAnswer` now represents the valid answers to FizzBuzz, not `One(String)`or `Many(Vec>String>)` - Python implementation updated to work with rust v4.0.0 which brings slight performance improvements (approx 10-20%) <!-- Generated by sourcery-ai[bot]: start summary --> ## Summary by Sourcery This pull request introduces significant performance improvements by updating the return types for `FizzBuzz` and `MultiFizzBuzz`. The `FizzBuzzAnswer` 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. * **New Features**: - Introduced new return types for `FizzBuzz` and `MultiFizzBuzz` to improve performance, including lazy evaluation with `rayon::iter::IndexedParallelIterator`. * **Enhancements**: - Updated `FizzBuzzAnswer` to represent valid FizzBuzz answers directly, removing the need for `One(String)` and `Many(Vec<String>)` variants. - Enhanced the Python implementation to work with Rust v4.0.0, resulting in slight performance improvements (approx 10-20%). * **Documentation**: - Updated documentation to reflect new return types and usage examples for `FizzBuzz` and `MultiFizzBuzz`. * **Tests**: - Added new tests to cover the updated `FizzBuzzAnswer` and `MultiFizzBuzz` implementations, including tests for negative numbers and non-whole numbers. - Updated existing tests to use the new return types and ensure compatibility with the new implementation. <!-- Generated by sourcery-ai[bot]: end summary -->
- Loading branch information
1 parent
182e5e5
commit 8f85294
Showing
10 changed files
with
243 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
3.0.0 | ||
3.0.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "fizzbuzz" | ||
version = "3.0.2" | ||
version = "4.0.0" | ||
edition = "2021" | ||
|
||
[lib] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.