public async Task TestSingleMapping() { SQLiteConnection sqlite = new SQLiteConnection("Data Source=:memory:"); sqlite.Open(); FillDatabase(sqlite); SimpleDbMapper mapper = new SimpleDbMapper(); long memUsageBefore = GC.GetTotalMemory(true); var sw = Stopwatch.StartNew(); var result = await mapper.GetAsync <User>(sqlite, "SELECT Name FROM Users WHERE Id = 1", null, CancellationToken.None); sw.Stop(); var memoryUsed = ((double)GC.GetTotalMemory(false) - memUsageBefore).ToReadableBytes(); var meanMemoryUsed = ((double)GC.GetTotalMemory(true) - memUsageBefore).ToReadableBytes(); }
public async Task TestLazyMapping() { SQLiteConnection sqlite = new SQLiteConnection("Data Source=:memory:"); sqlite.Open(); FillDatabase(sqlite); SimpleDbMapper mapper = new SimpleDbMapper(); long memUsageBefore = GC.GetTotalMemory(true); var sw = Stopwatch.StartNew(); for (int i = 0; i < 1; i++) { var result = await mapper.GetAsync <long>(sqlite, "SELECT Count(*) FROM Users", null, CancellationToken.None); } sw.Stop(); var memoryUsed = ((double)GC.GetTotalMemory(false) - memUsageBefore); var meanMemoryUsed = ((double)GC.GetTotalMemory(true) - memUsageBefore); }