Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nwrenger/countbattle
A battle between counting algorithms.
https://github.com/nwrenger/countbattle
algorithms battle counting-lists rust
Last synced: about 1 month ago
JSON representation
A battle between counting algorithms.
- Host: GitHub
- URL: https://github.com/nwrenger/countbattle
- Owner: nwrenger
- License: mit
- Created: 2023-04-07T12:12:37.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-07-01T19:31:05.000Z (6 months ago)
- Last Synced: 2024-11-24T20:39:45.931Z (about 1 month ago)
- Topics: algorithms, battle, counting-lists, rust
- Language: Rust
- Homepage:
- Size: 10.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# countbattle
In this repo are getting two solutions of the problem stated in **[this video](https://youtu.be/U6I-Kwj-AvY)** from the Youtuber **[code_report](https://www.youtube.com/@code_report)** compared. Both are in Rust and you can compare them using the hyperfine command.Which will be faster?!?!
## Dependencies
Only hyperfine has to be installed using cargo, the other dependencies are stated in the Cargo.toml:
```
cargo install hyperfine
```
Alternatively hyperfine can also be installed with a package manager e.g. `sudo pacman -Syu hyperfine`.## Usage
Make sure to compile the release build of the programm before using the hyperfine command:
```
cargo build -r
```
For my Rust solution:
```
hyperfine --warmup 6 -- "target/release/countbattle nils -s 69 -l 500000"
```
For the Rust solution from code_report's video:
```
hyperfine --warmup 6 -- "target/release/countbattle internet -s 69 -l 500000"
```
The Makefile should execute all the above commands (if rust is installed)
```
make test-all
```
The shell script only executes the test cases. The first argument to the script is the seed, the second the length of the
test array
```
./test-all.sh 69 5000000
```
For the generated list(print!):
```
hyperfine --warmup 6 --show-output -- "target/release/countbattle uncounted -s 69 -l 500000"
```
with -s you can set the seed for the generated list and with -l you can specify the length of the list.And who wins?!?! Compare them yourself!