Skip to content

perf(classic): pass in-param strings as fast-pass HSTRING references - #62

Draft
triniwiz wants to merge 1 commit into
mainfrom
perf/winrt-fast-pass-strings-only
Draft

triniwiz wants to merge 1 commit into
mainfrom
perf/winrt-fast-pass-strings-only

Conversation

@triniwiz

@triniwiz triniwiz commented Dec 2, 2026

Copy link
Copy Markdown
Member

In-param strings in the classic MethodCall::call now pass as fast-pass HSTRING references (WindowsCreateStringReference).

Change

  • The JS string's UTF-16 is copied into per-call storage: 64 code units inline, larger strings on the heap.
  • The header and buffer live for the call, which is all an in-param needs; a callee that keeps the string duplicates it.
  • Each string used to cost a Vec<u16> plus a heap HSTRING copy. A reference needs neither, and nothing is released after the call.
  • Strings that arrive as HSTRING-backed objects still reuse their handle as before.

Performance

x64 Release, measured in an app calling WinRT statics in a loop, best of 9 rounds.

Call Before After
A static taking (UIElement, Int32, String, Single, Single), short string 0.45–0.51 µs 0.36–0.39 µs

Tests
cargo test -p runtime --lib gives the same result as main: 195 passed, and the same 15 failures, which need COM activation, HTTP or a UI dispatcher in that environment.

@coderabbitai

coderabbitai Bot commented Dec 2, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a900eec8-6581-4039-a288-3d8717ab5f2a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant