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

Generate fully qualified lambda signatures for better compilation speed #33773

Open
roji opened this issue May 21, 2024 · 0 comments
Open

Generate fully qualified lambda signatures for better compilation speed #33773

roji opened this issue May 21, 2024 · 0 comments

Comments

@roji
Copy link
Member

roji commented May 21, 2024

Especially in the compiled model, we currently generate lambdas which aren't fully qualified:

       activityTagPacketFrameRow.TypeMapping = SqlServerLongTypeMapping.Default.Clone(
                comparer: new ValueComparer<long>(
                    (long v1, long v2) => v1 == v2,
                    (long v) => v.GetHashCode(),
                    (long v) => v),
                keyComparer: new ValueComparer<long>(
                    (long v1, long v2) => v1 == v2,
                    (long v) => v.GetHashCode(),
                    (long v) => v),
                providerValueComparer: new ValueComparer<long>(
                    (long v1, long v2) => v1 == v2,
                    (long v) => v.GetHashCode(),
                    (long v) => v));

For better compilation, it is highly recommended to specify the return value of the lambdas, to avoid the need for inference:

// current 
(long v1, long v2) => v1 == v2;
// preferred
bool (long v1, long v2) => v1 == v2;

Raised by @jaredpar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants