Skip to content

Instantly share code, notes, and snippets.

@ayende
Created April 23, 2019 06:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ayende/788fddf4d1db834460736bf3a2bc8ff6 to your computer and use it in GitHub Desktop.
Save ayende/788fddf4d1db834460736bf3a2bc8ff6 to your computer and use it in GitHub Desktop.
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