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

Stop eagerly loading methods/members via reflection which aren't necessarily needed #27113

Open
Tracked by #21894
roji opened this issue Jan 5, 2022 · 0 comments
Open
Tracked by #21894
Assignees
Labels
area-aot area-perf area-query consider-for-current-release punted-for-7.0 Originally planned for the EF Core 7.0 (EF7) release, but moved out due to resource constraints. type-enhancement
Milestone

Comments

@roji
Copy link
Member

roji commented Jan 5, 2022

In many translators, we currently eagerly load MethodInfos and MemberInfos via reflection at static construction, and then do a reference comparison to match against them. #26288 changes the loading to be compatible with trimming, but this still means that all these methods/members never get trimmed regardless whether the user application actually needs them or not.

We can switch to matching methods by name, possibly by using a string switch which also verifies parameters. This would avoid the linker dependency on these things, and allow trimming them if not used by the user. Note that we should do this on a case-by-case basis; method translators should probably use this, whereas EnumerableMethods/QueryableMethods can probably stay as they are.

In addition, this may speed up our startup time as less reflection lookups will be performed.

Suggested by @ajcvickers

@roji roji self-assigned this Jan 5, 2022
@ajcvickers ajcvickers added this to the 7.0.0 milestone Jan 5, 2022
@ajcvickers ajcvickers added punted-for-7.0 Originally planned for the EF Core 7.0 (EF7) release, but moved out due to resource constraints. and removed propose-punt labels Apr 23, 2022
@ajcvickers ajcvickers modified the milestones: 7.0.0, Backlog Apr 23, 2022
@ajcvickers ajcvickers assigned AndriySvyryd and unassigned roji Oct 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-aot area-perf area-query consider-for-current-release punted-for-7.0 Originally planned for the EF Core 7.0 (EF7) release, but moved out due to resource constraints. type-enhancement
Projects
None yet
Development

No branches or pull requests

3 participants