Created
November 21, 2011 21:17
-
-
Save stefansedich/1383969 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| var store = new DocumentStore { Url = "http://localhost:8080" }.Initialize(); | |
| try | |
| { | |
| var sw = Stopwatch.StartNew(); | |
| Parallel.ForEach(Enumerable.Range(0, 10000), i => | |
| { | |
| var session = store.OpenSession(); | |
| session.Store(new Person { Name = Guid.NewGuid().ToString() }); | |
| session.SaveChanges(); | |
| }); | |
| sw.Stop(); | |
| Console.WriteLine("RavenDB Took: {0}", sw.Elapsed.ToString()); | |
| } | |
| catch (Exception ex) | |
| { | |
| Console.WriteLine("RavenDB Failed: {0}", ex); | |
| } | |
| try | |
| { | |
| var sw = Stopwatch.StartNew(); | |
| Parallel.ForEach(Enumerable.Range(0, 10000), i => | |
| { | |
| var connection = new SqlConnection(@"Data Source=localhost\SQLEXPRESS;Initial Catalog=Test;Integrated Security=SSPI;"); | |
| connection.Open(); | |
| connection.Execute("INSERT INTO PEOPLE (Name) VALUES (@Name)", new { Name = Guid.NewGuid().ToString() }); | |
| connection.Close(); | |
| }); | |
| sw.Stop(); | |
| Console.WriteLine("SQL Took: {0}", sw.Elapsed.ToString()); | |
| } | |
| catch (Exception ex) | |
| { | |
| Console.WriteLine("SQL Failed {0}", ex); | |
| } | |
| Console.ReadKey(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment