AI REVIEWED
Module: cli
File: cli/format/YamlSnakeYamlFormatHandler.java
Severity: Medium
Summary
Unlike all Jackson-based handlers which reuse static mapper instances, the SnakeYAML handler creates a new Yaml instance on every serialize() and serializePretty() call. This causes unnecessary allocation overhead.
Suggested Fix
Cache Yaml instances as fields:
private final Yaml compactYaml = new Yaml(this.compactOptions);
private final Yaml prettyYaml = new Yaml(this.prettyOptions);