Problem
crates/tday-nativecore/src/platform/macos/ax.rs L507, L514–515
Helper functions like ax_children, get_string, get_bool, and get_ax_value allocate a new CFString on every call:
unsafe fn get_string(el: AXUIElementRef, attr_name: &str) -> Option<String> {
let attr = CFString::new(attr_name); // ← allocates on every call
...
}
A 10,000-node AX tree snapshot calls get_string/get_bool 5–8 times per node, totalling ~50,000–80,000 CFString heap allocations per snapshot.
Suggested fix
Declare commonly used attribute names (AXRole, AXTitle, AXValue, AXDescription, AXEnabled, AXFocused, AXChildren, AXPosition, AXSize) as global lazy_static or once_cell::sync::Lazy<CFString> constants and reuse them for the lifetime of the process.
Problem
crates/tday-nativecore/src/platform/macos/ax.rsL507, L514–515Helper functions like
ax_children,get_string,get_bool, andget_ax_valueallocate a newCFStringon every call:A 10,000-node AX tree snapshot calls
get_string/get_bool5–8 times per node, totalling ~50,000–80,000 CFString heap allocations per snapshot.Suggested fix
Declare commonly used attribute names (
AXRole,AXTitle,AXValue,AXDescription,AXEnabled,AXFocused,AXChildren,AXPosition,AXSize) as globallazy_staticoronce_cell::sync::Lazy<CFString>constants and reuse them for the lifetime of the process.