mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 08:20:00 +09:00
Avoid file retrieval overhead when detaching BeatmapSetInfo
It seems that no usages of `BeatmapSetInfo` detaches require files - a `WorkingBeatmap` is always obtained before doing further lookups. Therefore we can omit this include unless the detaching object is a `BeatmapInfo`. A refetch is performed when retrieving a `WorkingBeatmap` to complete the equation.
This commit is contained in:
@ -76,6 +76,14 @@ namespace osu.Game.Database
|
||||
{
|
||||
applyCommonConfiguration(c);
|
||||
|
||||
c.CreateMap<BeatmapSetInfo, BeatmapSetInfo>()
|
||||
.MaxDepth(2)
|
||||
.AfterMap((s, d) =>
|
||||
{
|
||||
foreach (var beatmap in d.Beatmaps)
|
||||
beatmap.BeatmapSet = d;
|
||||
});
|
||||
|
||||
// This can be further optimised to reduce cyclic retrievals, similar to the optimised set mapper below.
|
||||
// Only hasn't been done yet as we detach at the point of BeatmapInfo less often.
|
||||
c.CreateMap<BeatmapInfo, BeatmapInfo>()
|
||||
@ -100,6 +108,15 @@ namespace osu.Game.Database
|
||||
{
|
||||
applyCommonConfiguration(c);
|
||||
|
||||
c.CreateMap<BeatmapSetInfo, BeatmapSetInfo>()
|
||||
.MaxDepth(2)
|
||||
.ForMember(b => b.Files, cc => cc.Ignore())
|
||||
.AfterMap((s, d) =>
|
||||
{
|
||||
foreach (var beatmap in d.Beatmaps)
|
||||
beatmap.BeatmapSet = d;
|
||||
});
|
||||
|
||||
c.CreateMap<BeatmapInfo, BeatmapInfo>()
|
||||
.MaxDepth(1)
|
||||
.ForMember(b => b.BeatmapSet, cc => cc.Ignore());
|
||||
@ -131,13 +148,6 @@ namespace osu.Game.Database
|
||||
c.CreateMap<RealmUser, RealmUser>();
|
||||
c.CreateMap<RealmFile, RealmFile>();
|
||||
c.CreateMap<RealmNamedFileUsage, RealmNamedFileUsage>();
|
||||
c.CreateMap<BeatmapSetInfo, BeatmapSetInfo>()
|
||||
.MaxDepth(2)
|
||||
.AfterMap((s, d) =>
|
||||
{
|
||||
foreach (var beatmap in d.Beatmaps)
|
||||
beatmap.BeatmapSet = d;
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Reference in New Issue
Block a user