# Benchmark Fixtures

This directory records input fixtures used to exercise the parser and export
pipeline against the two Aseprite JSON shapes documented by Aseprite:

- examples/benchmarks/aseprite-json-hash.json is the public JSON-hash
  example linked from the Aseprite CLI documentation. It contains three
  32x32 frames and no tags or slices.
- examples/benchmarks/aseprite-json-array.json is the matching public
  JSON-array example. It contains the same three frames in array form.
- examples/benchmarks/character-animation.json is a project-owned,
  representative animation fixture with trimmed frames, forward and
  ping-pong tags, a multi-key collision slice, and a multi-key nine-patch
  slice. It is intentionally small enough to inspect in a code review while
  exercising the production path.

The first two fixtures are derived from the examples linked in the official
Aseprite CLI documentation:

<https://github.com/aseprite/docs/blob/main/cli.md>

The official documentation states that --format json-hash is the default and
--format json-array selects the array representation. It also documents the
frameTags and slices.keys fields used by the third fixture:

<https://gist.github.com/dacap/db18e5747a4b6e208d3c>

<https://gist.github.com/dacap/a32adb9248320326733a>

## Expected workload

| Fixture | Frames | Tags | Slice keys | Main coverage |
| --- | ---: | ---: | ---: | --- |
| JSON-hash | 3 | 0 | 0 | object decoding and stable ordering |
| JSON-array | 3 | 0 | 0 | array decoding and legacy compatibility |
| character-animation | 5 | 2 | 4 | trim metadata, ping-pong timeline, collision and nine-patch keyframes |

## Reproduced results

The following values were produced by running the checked-in fixtures through
`benchmark_report` with the default atlas configuration (`max_width=1024`,
`padding=1`) on the current stable MoonBit toolchain. They are output values,
not estimates.

| Fixture | Frames | Tags | Slices | Total duration | Atlas | Packed area | Occupancy | Errors | Warnings |
| --- | ---: | ---: | ---: | ---: | --- | ---: | ---: | ---: | ---: |
| aseprite-json-array.json | 3 | 0 | 0 | 300 | 1024x34 | 3072 | 0.08823529411764706 | 0 | 0 |
| aseprite-json-hash.json | 3 | 0 | 0 | 300 | 1024x34 | 3072 | 0.08823529411764706 | 0 | 0 |
| character-animation.json | 5 | 2 | 2 | 480 | 1024x34 | 3840 | 0.11029411764705882 | 0 | 0 |

The test suite adds malformed variants in memory so that invalid input does not
need to be stored as a misleading real asset. Those cases cover empty frames,
invalid durations, zero-sized rectangles, out-of-bounds frames and tags,
duplicate names, invalid nine-patch centers, and invalid atlas constraints.
