Skip to content

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.

5 participants