Skip to content

Speed up stuff

Benjamin Otte requested to merge wip/otte/merge-ops into main

When ops get allocated that use the same stats as the last op, put them into the same ShaderOp. This reduces the number of ShaderOps we need to record, which has 3 benefits:

  1. It's less work when iterating over all the ops. This isn't a big win, but it makes submit() and print() run a bit faster.
  2. We don't need to manage data per-op. This is a large win because we don't need to ref/unref descriptors as much anymore, and refcounting is visible on profiles.
  3. We save memory. This is a pretty big win because we iterate over ops a lot, and when the array is large enough (I've managed to write testcases that makes it grow to over 4GB) it kills all the caches and that's bad.

The main benefit of all this are glyphs, which used to emit 1 ShaderOp per glyph and can now end up with 1 ShaderOp for multiple text nodes, even if those text nodes use different fonts or colors - because they can all share the same ColorizeOp.

Merge request reports