#[allow(clippy::single_component_path_imports)]
use auto_allocator;
fn main() {
#[cfg(not(target_arch = "wasm32"))]
env_logger::init();
println!("๐ Auto Allocator Demo");
println!("======================");
let info = auto_allocator::get_allocator_info();
println!("โ
Selected allocator: {:?}", info.allocator_type);
println!("๐ Reason: {}", info.reason);
println!();
println!("๐ฏ Runtime Hardware Selection:");
println!("- Debug builds: automatically use system allocator");
println!("- Release + modern platforms: automatically use mimalloc (best performance)");
println!("- WASM/Mobile platforms: system allocator for compatibility");
println!("- Embedded systems: specialized embedded allocator");
println!();
println!("๐ Based on Microsoft and independent performance research:");
println!(" โข mimalloc provides superior multi-threaded performance");
println!(" โข Up to 1.6x faster than system allocators in complex workloads");
println!(" โข Better memory efficiency and cross-platform support");
println!("๐ก This is pure runtime selection - no configuration needed!");
println!();
let data: Vec<u8> = (0..1000).map(|i| (i % 256) as u8).collect();
println!(
"โ
Successfully allocated and populated Vec with {} bytes",
data.len()
);
let text = "Hello, world!".repeat(100);
println!("โ
Successfully allocated String with {} bytes", text.len());
println!();
println!("๐ System Information:");
println!(" ๐ฅ๏ธ OS: {}", info.system_info.os_type);
println!(" โ๏ธ CPU Cores: {}", info.system_info.cpu_cores);
println!(
" ๐ง Total Memory: {}",
auto_allocator::format_memory_size(info.system_info.total_memory_bytes)
);
println!(" ๐ WASM: {}", info.system_info.is_wasm);
println!(" ๐ Debug Build: {}", info.system_info.is_debug);
println!(" ๐๏ธ Architecture: {}", info.system_info.target_arch);
}