-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCargo.toml
More file actions
97 lines (74 loc) · 3.27 KB
/
Cargo.toml
File metadata and controls
97 lines (74 loc) · 3.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
[package]
name = "auto-allocator"
version = "0.1.0"
edition = "2021"
authors = ["Yeauty <YeautyYE@gmail.com>"]
description = "Zero-configuration automatic memory allocator selection based on runtime hardware analysis and performance research"
license = "MIT OR Apache-2.0 OR MPL-2.0"
homepage = "https://github.com/YeautyYE/auto-allocator"
documentation = "https://docs.rs/auto-allocator"
repository = "https://github.com/YeautyYE/auto-allocator"
keywords = ["allocator", "memory", "performance", "automatic", "mimalloc"]
categories = ["memory-management", "development-tools"]
[lib]
name = "auto_allocator"
path = "src/lib.rs"
[dependencies]
[target.'cfg(not(target_os = "none"))'.dependencies]
log = "0.4"
once_cell = "1.19"
# High-performance allocator for desktop platforms where it provides significant benefits
# Automatically excluded on platforms with superior native allocators (Android Scudo, iOS libmalloc, BSD jemalloc)
[target.'cfg(any(target_os = "windows", target_os = "macos", all(target_os = "linux", not(target_arch = "wasm32"))))'.dependencies]
mimalloc = { version = "0.1.47", default-features = false, optional = true }
# Lightweight allocator for all embedded systems (no_std environments)
[target.'cfg(target_os = "none")'.dependencies]
embedded-alloc = { version = "0.5", optional = true }
[dev-dependencies]
# Conditional dev dependencies for WASM compatibility
[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
env_logger = "0.11"
criterion = { version = "0.5", features = ["html_reports"] }
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
criterion = { version = "0.5", default-features = false }
# Embedded-specific dependencies for no_std example
[target.'cfg(all(target_arch = "arm", target_os = "none"))'.dev-dependencies]
cortex-m = { version = "0.7", features = ["inline-asm"] }
cortex-m-rt = "0.7"
panic-halt = "0.2"
heapless = { version = "0.8", default-features = false }
cortex-m-semihosting = "0.5"
# Lock dependencies to ensure compatibility with Rust 1.80.0
half = "=2.4.1" # 2.6.0 requires Rust 1.81+
# Configure build to suppress warnings about uncommon target architectures
[lints.rust]
unexpected_cfgs = { level = "allow", check-cfg = ['cfg(target_arch, values("xtensa"))'] }
# Platform-specific system APIs for memory detection and logging
[target.'cfg(unix)'.dependencies]
libc = "0.2"
[target.'cfg(windows)'.dependencies]
winapi = { version = "0.3", features = ["sysinfoapi"] }
[target.'cfg(target_arch = "wasm32")'.dependencies]
wasm-bindgen = "0.2"
[features]
# Automatic selection of optimal allocator for each platform - no configuration required
default = ["_mimalloc", "_embedded"]
# Enhanced security mode with ~10% performance overhead for heap exploit protection
secure = ["_mimalloc_secure", "_embedded"]
# Internal implementation features - not intended for direct use
_mimalloc = ["dep:mimalloc"]
_mimalloc_secure = ["dep:mimalloc", "mimalloc/secure"]
_embedded = ["dep:embedded-alloc"]
[[example]]
name = "simple_demo"
path = "examples/simple_demo/main.rs"
[[example]]
name = "web_server"
path = "examples/web_server/main.rs"
# Note: embedded_system example is a separate package due to no_std requirements
[[example]]
name = "optimization_check"
path = "examples/optimization_check/main.rs"
[[bench]]
name = "allocator_benchmark"
harness = false