Skip to content

Instantly share code, notes, and snippets.

@gethari
Last active August 13, 2019 06:46
Show Gist options
  • Save gethari/61e0b6d5e7ee5df950f40983720c7855 to your computer and use it in GitHub Desktop.
Save gethari/61e0b6d5e7ee5df950f40983720c7855 to your computer and use it in GitHub Desktop.
[MemoryDiagnoser]
public class Benchmark {
private readonly SearchProperties _searchProperties;
public Benchmark() {
_properties = new Properties();
} [Benchmark(Baseline = true)]
public void WithDapper() {
var ids = new List < string > {
"05edc08b-c27f-4e4d-bb5c-0045959d93a4",
"a0290013-d568-407c-a1f3-340cdff10cb5", "4f6e2712-9412-4d84-90e4-44ccab389a44", "6f9eda0e-03ba-4456-8926-65713d9a35f9", "ec186495-8191-4e20-b090-72c2005f3681", "adc6f649-3058-4cc1-94c1-e9a36d9bda3d", "8406561b-247c-4e2e-a45a-ebe35b2af715"
};
foreach(var id in ids) {
var appId = Guid.Parse(id);
_properties.WithDapper(appId);
}
} [Benchmark]
public void WithoutDapper() {
var ids = new List < string > {
"05edc08b-c27f-4e4d-bb5c-0045959d93a4",
"a0290013-d568-407c-a1f3-340cdff10cb5", "4f6e2712-9412-4d84-90e4-44ccab389a44", "6f9eda0e-03ba-4456-8926-65713d9a35f9", "ec186495-8191-4e20-b090-72c2005f3681", "adc6f649-3058-4cc1-94c1-e9a36d9bda3d", "8406561b-247c-4e2e-a45a-ebe35b2af715"
};
foreach(var id in ids) {
var appId = Guid.Parse(id);
_properties.WithoutDapper(appId).GetAwaiter().GetResult();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment