Skip to content

Add an AllocateString overload for InlineSString& #64

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 27, 2022

Conversation

scott-ferguson-unity
Copy link

Calling AllocateString passing in an InlineSSString
will compile, but AllocateString overload that is
calling takes an SString. This ends up calling the
SString(WCHAR*) conversion constructor, which means
we pay for another strlen & allocation.

To prevent us from accidentally hitting this again,
I've added local AllocateString that will take an
InlineString by reference.

On may machine this drops 1M mono_new_string_wrapper calls from 185ms to 109ms.

Calling AllocateString passing in an InlineSSString
will compile, but AllocateString overload that is
calling takes an SString.  This ends up calling the
SString(WCHAR*) conversion constructor, which means
we pay for another strlen & allocation.

To prevent us from accidentally hitting this again,
I've added local AllocateString that will take an
InlineString by reference.
@scott-ferguson-unity scott-ferguson-unity merged commit 2b90253 into unity-main Apr 27, 2022
@scott-ferguson-unity scott-ferguson-unity deleted the fix-allocation-from-inlinesstring branch April 27, 2022 19:24
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