diff --git a/Cargo.toml b/Cargo.toml index aa1af82c..dbf1a3a7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [features] -default = ["turf_processing"] +default = ["turf_processing", "katmos"] zas_hooks = [] turf_processing = [] superconductivity = ["turf_processing"] diff --git a/crates/auxmacros/src/lib.rs b/crates/auxmacros/src/lib.rs index b6095fe8..b18d51ad 100644 --- a/crates/auxmacros/src/lib.rs +++ b/crates/auxmacros/src/lib.rs @@ -91,7 +91,7 @@ pub fn generate_simd_functions( fn #func_name(#args_nonmut) #func_return { // This `unsafe` block is safe because we're testing // that the `avx2` feature is indeed available on our CPU. - if *crate::SIMD_DETECTED.get_or_init(|| is_x86_feature_detected!("avx2")) { + if *crate::_SIMD_DETECTED.get_or_init(|| is_x86_feature_detected!("avx2")) { unsafe { #func_ident_simd(#args_typeless) } } else { #func_ident_fallback(#args_typeless) @@ -103,6 +103,7 @@ pub fn generate_simd_functions( #func_ident_fallback(#args_typeless) } + #[inline(always)] fn #func_ident_fallback(#args) #func_return #body } diff --git a/src/lib.rs b/src/lib.rs index 189bb76c..328e7dd1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -17,7 +17,7 @@ use reaction::react_by_id; #[global_allocator] static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; -static SIMD_DETECTED: ::std::sync::OnceLock = ::std::sync::OnceLock::new(); +static _SIMD_DETECTED: ::std::sync::OnceLock = ::std::sync::OnceLock::new(); #[cfg(feature = "tracy")] #[byondapi::init] diff --git a/src/turfs/katmos.rs b/src/turfs/katmos.rs index bf0448dd..a9dc0d23 100644 --- a/src/turfs/katmos.rs +++ b/src/turfs/katmos.rs @@ -516,6 +516,7 @@ fn flood_fill_zones( let mut border_turfs: std::collections::VecDeque = Default::default(); let sender = byond_callback_sender(); let mut total_moles = 0.0_f32; + let mut is_planet = false; turf_graph.add_node(index_node); border_turfs.push_back(index_node); found_turfs.insert(index_turf); @@ -523,7 +524,13 @@ fn flood_fill_zones( while let Some(cur_index) = border_turfs.pop_front() { let cur_turf = arena.get(cur_index).unwrap(); let cur_turf_id = cur_turf.id; - + //hard cap for planet atmos because very large open space + if cur_turf.planetary_atmos.is_some() { + is_planet = true; + } + if is_planet && turf_graph.node_count() > equalize_hard_turf_limit { + break; + } total_moles += cur_turf.total_moles(); for (weight, adj_index, adj_mixture) in arena diff --git a/src/turfs/processing.rs b/src/turfs/processing.rs index a165fbd2..42d2a145 100644 --- a/src/turfs/processing.rs +++ b/src/turfs/processing.rs @@ -92,6 +92,7 @@ fn process_turf( } #[cfg_attr(not(target_feature = "avx2"), auxmacros::generate_simd_functions)] +#[cfg_attr(feature = "tracy", tracing::instrument(skip_all))] fn planet_process(planet_share_ratio: f32) { with_turf_gases_read(|arena| { GasArena::with_all_mixtures(|all_mixtures| { @@ -221,6 +222,7 @@ fn process_cell( // Solving the heat equation using a Finite Difference Method, an iterative stencil loop. #[cfg_attr(not(target_feature = "avx2"), auxmacros::generate_simd_functions)] +#[cfg_attr(feature = "tracy", tracing::instrument(skip_all))] fn fdm( (start_time, remaining_time): (&Instant, Duration), fdm_max_steps: i32, @@ -380,6 +382,7 @@ fn post_process_cell<'a>( // Goes through every turf, checks if it should reset to planet atmos, if it should // update visuals, if it should react, sends a callback if it should. #[cfg_attr(not(target_feature = "avx2"), auxmacros::generate_simd_functions)] +#[cfg_attr(feature = "tracy", tracing::instrument(skip_all))] fn post_process() { let vis = crate::gas::visibility_copies(); with_turf_gases_read(|arena| {