From 6c0be6913dd0bcbb7e17a3e2a4daa45fcc8f5103 Mon Sep 17 00:00:00 2001 From: mat Date: Fri, 30 Jan 2026 00:02:36 +0500 Subject: warn if pathfinder is running without optimizations, and other minor fixes --- azalea/src/pathfinder/mod.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'azalea/src/pathfinder') diff --git a/azalea/src/pathfinder/mod.rs b/azalea/src/pathfinder/mod.rs index 8df04b14..6f1a0d8a 100644 --- a/azalea/src/pathfinder/mod.rs +++ b/azalea/src/pathfinder/mod.rs @@ -32,7 +32,7 @@ use std::{ collections::VecDeque, sync::{ Arc, - atomic::{self, AtomicUsize}, + atomic::{self, AtomicBool, AtomicUsize}, }, thread, time::{Duration, Instant}, @@ -306,6 +306,16 @@ pub fn goto_listener( continue; }; + // this env variable is set from the build.rs + if env!("OPT_LEVEL") == "0" { + static WARNED: AtomicBool = AtomicBool::new(false); + if !WARNED.swap(true, atomic::Ordering::Relaxed) { + warn!( + "Azalea was compiled with no optimizations, which may result in significantly reduced pathfinding performance. Consider following the steps at https://azalea.matdoes.dev/azalea/#optimization for faster performance in debug mode." + ) + } + } + let cur_pos = player_pos_to_block_pos(**position); if event.goal.success(cur_pos) { -- cgit v1.2.3