dotnet / dotnet/efcore

Caching layer for the update pipeline

Open
#27,894 1 comment 1 reaction 0 assignees View on GitHub
area-perf area-save-changes
Dominant language
C#
Stars
14.8k
Forks
3.4k
PR merge metrics
PR metrics pending

Description

Our perf focus in EF Core 7.0 was on the update pipeline, and specifically reducing database roundtrips and emitting better-performing SQL (https://github.com/dotnet/efcore/issues/26797#issue-1061018115). Specifically, we did not focus on runtime performance (i.e. reducing allocations and CPU time in the code itself).

While there are definitely opportunities for runtime optimizations in the update pipeline, it may be better to look into caching layer above the entire pipeline; SaveChanges involves a lot of work in order to produce the actual SQL commands, and it would be better to avoid that entirely, so that it's only performed the first time a particular kind of SaveChanges is performed. This would be similar to how the query pipeline works: the compilation process is heavy and not hyper-optimized, but it only happens once for a given query tree, and the results are cached for subsequent use.

The problem is of course the construction of a reliable, correct cache key encompassing the entire SaveChanges. If not feasible, we may be able to solve this problem for a common subset of cases (e.g. single-row SaveChanges only).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.