Created
April 23, 2019 06:27
-
-
Save ayende/788fddf4d1db834460736bf3a2bc8ff6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TestItem | |
{ | |
public long A, B; | |
} | |
public static class Program | |
{ | |
public static async Task Main(string[] args) | |
{ | |
using (var store = new DocumentStore | |
{ | |
Urls = new[] { "http://localhost:8080" }, | |
Database = "test" | |
}) | |
{ | |
store.Initialize(); | |
var sp = Stopwatch.StartNew(); | |
using (var bulk = store.BulkInsert()) | |
{ | |
for (int i = 0; i < 10_000_000; i++) | |
{ | |
var t = bulk.StoreAsync(new TestItem | |
{ | |
A = i, | |
B = i | |
}); | |
if (t.IsCompleted) | |
continue; | |
await t; | |
} | |
} | |
Console.WriteLine(sp.ElapsedMilliseconds); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment