Skip to content

Commit

Permalink
Fix up file store and add perf tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmontemagno committed Dec 20, 2017
1 parent add6f3a commit dab64d7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
Binary file added performance.xlsx
Binary file not shown.
1 change: 1 addition & 0 deletions src/MonkeyCache.FileStore/Barrel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class Barrel : IBarrel
index = new Dictionary<string, Tuple<string, DateTime>>();

LoadIndex();
WriteIndex();
}

public static string ApplicationId { get; set; } = string.Empty;
Expand Down
18 changes: 13 additions & 5 deletions src/MonkeyCache.TestsShared/BarrelTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -292,12 +292,19 @@ public void DoesNotExistsTest()
Assert.IsFalse(barrel.Exists(url));
}

#endregion
#endregion

#region Performance Tests
#region Performance Tests

#if DEBUG
[TestMethod]

[TestMethod]
public void PerformanceTests1()
{
PerformanceTestRunner(1, true, 1);
}

[TestMethod]
public void PerformanceTestsJson1()
{
PerformanceTestRunner(1, true, 1, true);
Expand All @@ -306,7 +313,7 @@ public void PerformanceTestsJson1()
[TestMethod]
public void PerformanceTestsJson10()
{
PerformanceTestRunner(1, true, 1000, true);
PerformanceTestRunner(1, true, 10, true);
}

[TestMethod]
Expand All @@ -333,6 +340,7 @@ public void PerformanceTestsMultiThreadedWithDuplicatesJson()
PerformanceTestRunner(4, true, 1000, true);
}


[TestMethod]
public void PerformanceTests()
{
Expand Down Expand Up @@ -406,7 +414,7 @@ void PerformanceTestRunner (int threads, bool allowDuplicateKeys, int keysPerThr
stopwatch.Stop();
Debug.WriteLine($"Empty ({tId}) took {stopwatch.ElapsedMilliseconds} ms");

Assert.IsTrue(stopwatch.ElapsedMilliseconds > 1);
Assert.IsTrue(stopwatch.ElapsedMilliseconds > 0);
});

task.ContinueWith(t => {
Expand Down

0 comments on commit dab64d7

Please sign in to comment.