From a475e4f7cf642eb06dda44498e10a58a300ad4b1 Mon Sep 17 00:00:00 2001 From: jacekpoz Date: Thu, 6 Jun 2024 07:28:03 +0200 Subject: [PATCH] aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --- lab4/zad6/Cargo.lock | 2 +- lab4/zad6/Cargo.toml | 2 +- lab4/zad6/src/main.rs | 2 ++ libtree/src/splay_tree.rs | 3 +++ 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lab4/zad6/Cargo.lock b/lab4/zad6/Cargo.lock index 6105ce8..b8bbd7b 100644 --- a/lab4/zad6/Cargo.lock +++ b/lab4/zad6/Cargo.lock @@ -275,7 +275,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" [[package]] -name = "zad4" +name = "zad6" version = "0.1.0" dependencies = [ "dashmap", diff --git a/lab4/zad6/Cargo.toml b/lab4/zad6/Cargo.toml index a434ff7..06dbc44 100644 --- a/lab4/zad6/Cargo.toml +++ b/lab4/zad6/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "zad4" +name = "zad6" version = "0.1.0" edition = "2021" diff --git a/lab4/zad6/src/main.rs b/lab4/zad6/src/main.rs index b64c34e..a50f6c4 100644 --- a/lab4/zad6/src/main.rs +++ b/lab4/zad6/src/main.rs @@ -76,6 +76,8 @@ fn write_max(results_map: &DashMap>) -> DashMap { fn main() -> io::Result<()> { + rayon::ThreadPoolBuilder::new().stack_size(1024 * 1024 * 1024).build_global().unwrap(); + let m = 20; let asc_results: Arc>> = Arc::new(DashMap::new()); diff --git a/libtree/src/splay_tree.rs b/libtree/src/splay_tree.rs index 534208c..2cf86dd 100644 --- a/libtree/src/splay_tree.rs +++ b/libtree/src/splay_tree.rs @@ -292,8 +292,10 @@ impl SplayTree { if node.parent() == self.root { self.stats.reads += 1; if node == node.parent().left() { + self.stats.reads += 1; self.rotate_right(node.parent()); } else { + self.stats.reads += 1; self.rotate_left(node.parent()); } } else { @@ -382,6 +384,7 @@ impl SplayTree { let mut temp = &self.root; unsafe { loop { + self.stats.comparisons += 1; let next = match key.cmp(&(*temp.0).key) { Ordering::Less => &mut (*temp.0).left, Ordering::Greater => &mut (*temp.0).right,