Skip to content
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

Use GeneratedDllImport in System.Security.Cryptography.Encoding #53111

Conversation

elinor-fung
Copy link
Member

Original (B) Converted (B) + (B) + (%)
linux 43008 47104 4096 9.52
windows 40448 41472 1024 2.53
linux R2R 91136 104448 13312 14.61
windows R2R 83456 86016 2560 3.07

cc @AaronRobinsonMSFT @jkoritzinsky

isAllocFailure = lastIsAllocFailure;

lastRead = ErrGetErrorAlloc(out lastIsAllocFailure);
error = ErrGetErrorAlloc(&isAllocFailure);
Copy link
Member

@jkotas jkotas May 22, 2021

Choose a reason for hiding this comment

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

This cal call ErrGetErrorAlloc just once to make the code smaller:

ulong error = 0;
bool isAllocFailure = false;
while (true)
{
    ulong lastRead = ErrGetErrorAlloc(&lastIsAllocFailure);

    // 0 (there's no named constant) is only returned when the calls
    // to ERR_get_error exceed the calls to ERR_set_error.
    if (lastRead == 0)
        break;

    error = lastRead;
    isAllocFailure = lastIsAllocFailure;
}

@jkotas
Copy link
Member

jkotas commented May 22, 2021

14.61

Do you have a sense where it is mostly comming from? Is it string marshaling or the SafeHandles, or something else?

@elinor-fung
Copy link
Member Author

I suspect it is from string marshalling, followed by safe handles.

I'm not actually sure what the best way would be to determine the breakdown. I had just done an r2rdump --diff between the two binaries and saw the functions marshalling strings and safe handles were at the top, then just strings, and just safe handles.

@elinor-fung elinor-fung force-pushed the convert-CryptographyEncoding branch from b906f1a to 32dacc0 Compare May 24, 2021 20:47
@elinor-fung elinor-fung merged commit 36955b1 into dotnet:feature/use-dllimport-generator May 25, 2021
@elinor-fung elinor-fung deleted the convert-CryptographyEncoding branch May 25, 2021 22:35
@ghost ghost locked as resolved and limited conversation to collaborators Jun 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants