Skip to content

[Feature]: SnakeYamlOps deepCopy() significantly slower than Jackson's built-in #162

@Splatcrafter

Description

@Splatcrafter

AI REVIEWED

Module: codec
File: codec/yaml/snakeyaml/SnakeYamlOps.java (~line 1259-1284)
Severity: Low

Problem / Motivation

SnakeYamlOps implements deepCopy() manually with recursive Java code (creating new ArrayLists, LinkedHashMaps, etc.), while Jackson-based implementations delegate to the optimized JsonNode.deepCopy(). For large data structures, this makes SnakeYAML operations measurably slower.

Proposed Solution

Consider optimizing the deep copy:

  1. Use iterative approach with explicit stack (avoids method call overhead)
  2. Profile to determine if this is actually a bottleneck in practice
  3. If not a bottleneck, document the performance characteristic

Alternatives

Document that SnakeYAML is slower for large structures and recommend Jackson-based implementations for performance-sensitive use cases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    performancePerformance problems or opportunities (runtime, memory, allocations, IO, startup)

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions