final timings and logs done

finished the readme
tweaked a few other things
This commit is contained in:
deepCurse 2024-08-15 17:41:28 -03:00
parent 5fe4829513
commit 33f9aaa7c9
Signed by: u1
GPG key ID: 0EA7B9E85212693C
6 changed files with 5816 additions and 7 deletions

4707
1_billion.log Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

11
1_milion.log Normal file
View file

@ -0,0 +1,11 @@
HIGH_SCORE: 0
ROLL_COUNT: 0
HIGH_SCORE: 92
ROLL_COUNT: 423264
HIGH_SCORE: 92
ROLL_COUNT: 856018
HIGH_SCORE: 92
ROLL_COUNT: 1000000
HIGH_SCORE: 92
ROLL_COUNT: 1000000
realtime 0:04.40

View file

@ -0,0 +1,7 @@
HIGH_SCORE: 74
ROLL_COUNT: 337
HIGH_SCORE: 91
ROLL_COUNT: 1000000
HIGH_SCORE: 91
ROLL_COUNT: 1000000
realtime 0:01.00

View file

@ -1,3 +1,20 @@
# graveler-softlockpicking-years-wasted-calculator
This repo is a short and sweet response to Austins most recent video 'The Science of Soft Lock Picking Pokemon' available here https://www.youtube.com/watch?v=M8C8dHQE2Ro
This repo is a short and sweet response to Austins most recent video 'The Science of Soft Lock Picking Pokemon' available here https://www.youtube.com/watch?v=M8C8dHQE2Ro
## Programs
[`time`](https://www.gnu.org/software/time/) to record execution time
[`rustup`](https://rustup.rs/) to install cargo, and all other tools used by the rust ecosystem
[`cargo`](https://github.com/rust-lang/cargo) to compile the program
# Timings
### 1 billion
comparable to the python implementation: 39:12.67
multithreading and a better random library: 8:51.31
### 1 million
comparable to the python implementation: 0:04.40
multithreading and a better random library: 0:01.00

View file

@ -4,8 +4,8 @@ use std::{
time::Duration,
};
//const ITER_COUNT: usize = 1_000_000_000;
const ITER_COUNT: usize = 1_000_000;
const ITER_COUNT: usize = 1_000_000_000;
//const ITER_COUNT: usize = 1_000_000;
static THREAD_STOP: AtomicBool = AtomicBool::new(false);
static ROLL_COUNT: AtomicUsize = AtomicUsize::new(0);
@ -34,7 +34,7 @@ fn main() {
#[cfg(feature = "auto_thread_count")]
let thread_count: usize = num_cpus::get();
#[cfg(not(feature = "auto_thread_count"))]
let thread_count: usize = 4; // Change me to any number you want to use as the thread count, please note you must not be using the 'auto_thread_count' feature, see README.md for details
let thread_count: usize = 1; // Change me to any number you want to use as the thread count, please note you must not be using the 'auto_thread_count' feature, see README.md for details
// divide the total iter count among multiple threads
let thread_dispatch = {
@ -63,7 +63,8 @@ fn main() {
}
loop {
println!("{}", HIGH_SCORE.load(Ordering::SeqCst));
println!("HIGH_SCORE: {}", HIGH_SCORE.load(Ordering::SeqCst));
println!("ROLL_COUNT: {}", ROLL_COUNT.load(Ordering::SeqCst));
// if all threads are done break the loop
{
@ -81,8 +82,8 @@ fn main() {
thread::sleep(Duration::from_secs(1));
}
println!("ROLL_COUNT: {}", ROLL_COUNT.load(Ordering::SeqCst));
println!("HIGH_SCORE: {}", HIGH_SCORE.load(Ordering::SeqCst));
println!("ROLL_COUNT: {}", ROLL_COUNT.load(Ordering::SeqCst));
}
fn number_cruncher(iter_count: usize) {
@ -97,7 +98,6 @@ fn number_cruncher(iter_count: usize) {
// turns
for _ in 0..231 {
// TODO compare this with a random usize % 4, or the classic (SEED^3)%4 trick
#[cfg(feature = "rust_random")]
let rand = rand::Rng::gen_range(&mut rand::thread_rng(), 0..4);
#[cfg(not(feature = "rust_random"))]