{
  "format": "perfr.story",
  "version": 1,
  "title": "Before: copying the timeline on every live frame",
  "summary": "A native client receiving a benchmark stream. This profile attributes most of the avoidable drawing work to expanding and copying pixel rows.",
  "capture": "/blog/captures/native-live-before.perfr.stream",
  "transition_ms": 700,
  "steps": [
    {
      "id": "context",
      "kind": "context",
      "title": "The live client",
      "body": "The native client receives a benchmark stream configured for one million events per second. The capture combines CPU sampling with three selected timing hooks; scheduler figures are not used in this analysis.",
      "duration_ms": 6000,
      "view": {
        "fit": "content",
        "scroll": {
          "kind": "y",
          "y": 0.0
        },
        "expanded": [
          {
            "kind": "process",
            "pid": 765996
          },
          {
            "kind": "thread",
            "pid": 765996,
            "tid": 765996
          }
        ],
        "collapsed": [
          {
            "kind": "scheduler"
          },
          {
            "kind": "process",
            "pid": 16711681
          },
          {
            "kind": "process",
            "pid": 761372
          },
          {
            "kind": "process",
            "pid": 761415
          }
        ],
        "focused": [
          {
            "kind": "process",
            "pid": 765996
          }
        ]
      },
      "overlays": [
        {
          "kind": "highlight",
          "id": "main",
          "target": {
            "kind": "track",
            "track": {
              "kind": "thread",
              "pid": 765996,
              "tid": 765996
            }
          }
        }
      ]
    },
    {
      "id": "copies",
      "kind": "evidence",
      "title": "Memory copies lead the samples",
      "body": "In this capture, memmove accounts for 4,597 of 13,352 samples (34.4%). Call stacks place major callers in raster expansion, row repacking, and the texture upload.",
      "duration_ms": 7000,
      "view": {
        "t0_frac": 0.45,
        "t1_frac": 0.46,
        "fit": "span",
        "scroll": {
          "kind": "y",
          "y": 0.0
        },
        "expanded": [
          {
            "kind": "process",
            "pid": 765996
          },
          {
            "kind": "thread",
            "pid": 765996,
            "tid": 765996
          }
        ],
        "collapsed": [
          {
            "kind": "scheduler"
          },
          {
            "kind": "process",
            "pid": 16711681
          },
          {
            "kind": "process",
            "pid": 761372
          },
          {
            "kind": "process",
            "pid": 761415
          }
        ],
        "focused": [
          {
            "kind": "thread",
            "pid": 765996,
            "tid": 765996
          }
        ]
      },
      "overlays": [
        {
          "kind": "highlight",
          "id": "copies-main",
          "target": {
            "kind": "track",
            "track": {
              "kind": "thread",
              "pid": 765996,
              "tid": 765996
            }
          }
        }
      ]
    },
    {
      "id": "staging",
      "kind": "root_cause",
      "title": "A copy the API does not require",
      "body": "Across 1,571 calls in this capture, pack_rgba_aligned averages 1.563 ms. It allocates and copies the timeline to satisfy a 256-byte row alignment rule. That rule does not apply to Queue::write_texture.",
      "duration_ms": 7000,
      "view": {
        "t0_frac": 0.45,
        "t1_frac": 0.46,
        "fit": "span",
        "scroll": {
          "kind": "y",
          "y": 0.0
        },
        "expanded": [
          {
            "kind": "process",
            "pid": 765996
          },
          {
            "kind": "thread",
            "pid": 765996,
            "tid": 765996
          }
        ],
        "collapsed": [
          {
            "kind": "scheduler"
          },
          {
            "kind": "process",
            "pid": 16711681
          },
          {
            "kind": "process",
            "pid": 761372
          },
          {
            "kind": "process",
            "pid": 761415
          }
        ],
        "focused": [
          {
            "kind": "thread",
            "pid": 765996,
            "tid": 765996
          }
        ]
      },
      "overlays": [
        {
          "kind": "highlight",
          "id": "staging-scope",
          "target": {
            "kind": "scope",
            "scope_id": 2097153
          }
        }
      ]
    },
    {
      "id": "expansion",
      "kind": "evidence",
      "title": "One lane row becomes many identical rows",
      "body": "Across 1,571 calls in this capture, to_rgba8_placed averages 1.211 ms. It expands a single row of colors to the displayed lane height before the texture is copied again.",
      "duration_ms": 7000,
      "view": {
        "t0_frac": 0.45,
        "t1_frac": 0.46,
        "fit": "span",
        "scroll": {
          "kind": "y",
          "y": 0.0
        },
        "expanded": [
          {
            "kind": "process",
            "pid": 765996
          },
          {
            "kind": "thread",
            "pid": 765996,
            "tid": 765996
          }
        ],
        "collapsed": [
          {
            "kind": "scheduler"
          },
          {
            "kind": "process",
            "pid": 16711681
          },
          {
            "kind": "process",
            "pid": 761372
          },
          {
            "kind": "process",
            "pid": 761415
          }
        ],
        "focused": [
          {
            "kind": "thread",
            "pid": 765996,
            "tid": 765996
          }
        ]
      },
      "overlays": [
        {
          "kind": "highlight",
          "id": "expansion-scope",
          "target": {
            "kind": "scope",
            "scope_id": 2097154
          }
        }
      ]
    }
  ]
}