Skip to content

Conversation

@kennykerr
Copy link
Collaborator

@kennykerr kennykerr commented Sep 30, 2021

C++/WinRT provides WINRT_NO_MODULE_LOCK that may be used by apps or pinned DLLs (that don't support unloading) to avoid the overhead of tracking of a module reference count. This update further optimizes the factory cache in such cases since unloading has an impact on caching performance. With this change, C++/WinRT is on par with the Rust language. Previously, Rust was just slightly faster.

compare

Data from: https://github.com/kennykerr/lang-perf

cc @axelandrejs

Copy link

@JamesMcNellis JamesMcNellis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kennykerr kennykerr merged commit 6270dcc into master Sep 30, 2021
@kennykerr kennykerr deleted the fast_caching branch September 30, 2021 19:53
@jonwis
Copy link
Member

jonwis commented Sep 30, 2021

A DLL that compiles with this should be super careful to pin itself, yes? Is there a "pin" type that should be turned on to grab and leak a DLL reference, or is that up to the DLL to do?

@kennykerr
Copy link
Collaborator Author

kennykerr commented Sep 30, 2021

C++/WinRT will do this automatically. If you define WINRT_NO_MODULE_LOCK then C++/WinRT's implementation of DllCanUnloadNow will always return false and you are effectively pinned. Such DLLs can also not export DllCanUnloadNow as added insurance.

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.

4 participants