Skip to content

CmdPal: Icons (6/n) - Clean up managed icon conversion and harden failure handling - #50186

Open
Jiří Polášek (jiripolasek) wants to merge 3 commits into
dev/jpolasek/f/49937-cmdpal-managed-icon-helpersfrom
dev/jpolasek/f/49938-cmdpal-icon-managed-optimizations
Open

CmdPal: Icons (6/n) - Clean up managed icon conversion and harden failure handling#50186
Jiří Polášek (jiripolasek) wants to merge 3 commits into
dev/jpolasek/f/49937-cmdpal-managed-icon-helpersfrom
dev/jpolasek/f/49938-cmdpal-icon-managed-optimizations

Conversation

@jiripolasek

@jiripolasek Jiří Polášek (jiripolasek) commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

Summary of the Pull Request

Part 6 of 12 in the CmdPal icon-loading series. Depends on #50185. Next: #50187.

This PR cleans up the converted helpers and hardens failure handling without changing their API.

  • Pools temporary binary pixel buffers, adds a contiguous-stride copy path, and cleans up failed bitmap conversions.
  • Adds fast glyph-classification paths while preserving grapheme and emoji behavior.
  • Uses spans and suffix checks to avoid unnecessary path/extension strings.

Motivation: make the managed implementation safer and cheaper to maintain, while removing identifiable allocations and copying. Scheduling and cache policy remain separate changes.

Evidence

Historical adjacent-stage comparison (2026-08-18); shared method and limitations: the diagnostics foundation PR #50181. This is cleanup and hardening with targeted allocation/copy reductions, not a standalone snappiness claim.

  • A cold-ish applied average: 3.450 → 5.221 ms (+1.771 ms). Run ranges overlap (3.208–6.716 versus 4.881–6.319 ms), so the median alone does not identify a cleanup-induced regression.
  • B warm applied average: 2.181 → 2.866 ms (+0.685 ms), worse in all three pairs; p95 stayed ≤8 ms, but the median p99 bound rose ≤33 → ≤100 ms.
  • B warm queue-wait average: 0.863 → 2.399 ms; dispatcher-wait average: 6.265 → 7.908 ms.
  • B warm preparation average: 0.204 → 0.199 ms; cumulative measured icon UI time: 1325.415 → 1324.927 ms. Neither shows increased measured work corresponding to the extra delay.
  • B warm process CPU: 113515.625 → 109625.000 ms (−3.4%). There were no binary inputs in these runs, so they do not measure the buffer-pooling improvement.
  • Existing glyph, parser, and conversion tests exercise the optimized paths.

The extra delay is localized to waiting; no individual cleanup edit has been established as its cause. The following cache/materialization PR #50187 mitigates this warm case: applied average falls to 0.306 ms, p99 to ≤1 ms, and all 3590 list-row requests hit cache with no queued materializations in each of three runs. That is measured mitigation, not proof of the original cause or an explanation of every cold result.

Technical notes

  • ArrayPool.Shared reduces allocation frequency; it is not a fixed retained-memory budget. Renting and returning buffers correctly does not prove a process-memory reduction.
  • The stride shortcut applies only to a compatible contiguous layout; the row-copy path remains for other layouts.
  • “Starts with ASCII” cannot reject every emoji: keycap sequences contain ASCII plus combining code points. Fast paths must preserve the full grapheme rules.
  • Removing a substring on rejected binary references is useful for comma-containing URI payloads. It does not change successful binary-path parsing.

Implementation: src/modules/cmdpal/Microsoft.CmdPal.UI/Helpers/Icons/FontIconGlyphClassifier.cs.

PR Checklist

  • Communication: I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected
  • Tests: Added/updated and all pass
  • Localization: All end-user-facing strings can be localized
  • Dev docs: Added/updated
  • New binaries: Added on the required places
  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

@jiripolasek Jiří Polášek (jiripolasek) added the Product-Command Palette Refers to the Command Palette utility label Aug 27, 2026
@jiripolasek Jiří Polášek (jiripolasek) changed the title CmdPal: Clean up managed icon conversion and harden failure handling CmdPal: Icons (6/n) - Clean up managed icon conversion and harden failure handling Aug 27, 2026
@jiripolasek
Jiří Polášek (jiripolasek) marked this pull request as ready for review August 28, 2026 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Product-Command Palette Refers to the Command Palette utility Ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CmdPal: Icon loading (5/n) - Optimize managed icon conversion

2 participants