mirror of
https://github.com/osukey/osukey.git
synced 2025-04-29 02:37:25 +09:00
Update benchmarks in line with new structure
This commit is contained in:
parent
cdcf0947e6
commit
a89954d67f
@ -29,8 +29,10 @@ namespace osu.Game.Benchmarks
|
|||||||
|
|
||||||
realmFactory = new RealmContextFactory(storage, "client");
|
realmFactory = new RealmContextFactory(storage, "client");
|
||||||
|
|
||||||
using (var context = realmFactory.CreateContext())
|
realmFactory.Run(realm =>
|
||||||
context.Write(c => c.Add(TestResources.CreateTestBeatmapSetInfo(rulesets: new[] { new OsuRuleset().RulesetInfo })));
|
{
|
||||||
|
realm.Write(c => c.Add(TestResources.CreateTestBeatmapSetInfo(rulesets: new[] { new OsuRuleset().RulesetInfo })));
|
||||||
|
});
|
||||||
|
|
||||||
updateThread = new UpdateThread(() => { }, null);
|
updateThread = new UpdateThread(() => { }, null);
|
||||||
updateThread.Start();
|
updateThread.Start();
|
||||||
@ -39,15 +41,15 @@ namespace osu.Game.Benchmarks
|
|||||||
[Benchmark]
|
[Benchmark]
|
||||||
public void BenchmarkDirectPropertyRead()
|
public void BenchmarkDirectPropertyRead()
|
||||||
{
|
{
|
||||||
using (var context = realmFactory.CreateContext())
|
realmFactory.Run(realm =>
|
||||||
{
|
{
|
||||||
var beatmapSet = context.All<BeatmapSetInfo>().First();
|
var beatmapSet = realm.All<BeatmapSetInfo>().First();
|
||||||
|
|
||||||
for (int i = 0; i < ReadsPerFetch; i++)
|
for (int i = 0; i < ReadsPerFetch; i++)
|
||||||
{
|
{
|
||||||
string _ = beatmapSet.Beatmaps.First().Hash;
|
string _ = beatmapSet.Beatmaps.First().Hash;
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
[Benchmark]
|
[Benchmark]
|
||||||
@ -78,15 +80,15 @@ namespace osu.Game.Benchmarks
|
|||||||
[Benchmark]
|
[Benchmark]
|
||||||
public void BenchmarkRealmLivePropertyRead()
|
public void BenchmarkRealmLivePropertyRead()
|
||||||
{
|
{
|
||||||
using (var context = realmFactory.CreateContext())
|
realmFactory.Run(realm =>
|
||||||
{
|
{
|
||||||
var beatmapSet = context.All<BeatmapSetInfo>().First().ToLive(realmFactory);
|
var beatmapSet = realm.All<BeatmapSetInfo>().First().ToLive(realmFactory);
|
||||||
|
|
||||||
for (int i = 0; i < ReadsPerFetch; i++)
|
for (int i = 0; i < ReadsPerFetch; i++)
|
||||||
{
|
{
|
||||||
string _ = beatmapSet.PerformRead(b => b.Beatmaps.First().Hash);
|
string _ = beatmapSet.PerformRead(b => b.Beatmaps.First().Hash);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
[Benchmark]
|
[Benchmark]
|
||||||
@ -117,15 +119,15 @@ namespace osu.Game.Benchmarks
|
|||||||
[Benchmark]
|
[Benchmark]
|
||||||
public void BenchmarkDetachedPropertyRead()
|
public void BenchmarkDetachedPropertyRead()
|
||||||
{
|
{
|
||||||
using (var context = realmFactory.CreateContext())
|
realmFactory.Run(realm =>
|
||||||
{
|
{
|
||||||
var beatmapSet = context.All<BeatmapSetInfo>().First().Detach();
|
var beatmapSet = realm.All<BeatmapSetInfo>().First().Detach();
|
||||||
|
|
||||||
for (int i = 0; i < ReadsPerFetch; i++)
|
for (int i = 0; i < ReadsPerFetch; i++)
|
||||||
{
|
{
|
||||||
string _ = beatmapSet.Beatmaps.First().Hash;
|
string _ = beatmapSet.Beatmaps.First().Hash;
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
[GlobalCleanup]
|
[GlobalCleanup]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user