Use plain vector compat members, add custom modes benchmark

The owned vectors add 48 bytes to ClimateTraits copies — this is the
cost of backward compat and will be removed in 2026.11.0.

Add ClimatePublish_WithCustomModes benchmark to show the improvement
for climate devices that use custom fan modes and presets (the case
that previously heap-allocated on every publish).
This commit is contained in:
J. Nick Koston
2026-03-26 13:10:04 -10:00
parent 3f1dfd0f3f
commit fe395ac41d
@@ -54,6 +54,9 @@ static void setup_hvac_climate(BenchClimate &climate) {
climate.traits_.set_visual_target_temperature_step(0.5f);
climate.traits_.set_visual_current_temperature_step(0.1f);
climate.traits_.add_feature_flags(climate::CLIMATE_SUPPORTS_CURRENT_TEMPERATURE | climate::CLIMATE_SUPPORTS_ACTION);
// Custom modes use the new API — stored on Climate entity, zero-copy in get_traits()
climate.set_supported_custom_fan_modes({"Turbo", "Silent", "Eco"});
climate.set_supported_custom_presets({"My Preset", "Night Mode"});
}
// --- Climate::publish_state() with temperature update ---