public MassiveList <Transaction> ReadTransactionTable() { Console.WriteLine(Environment.NewLine); Console.WriteLine("READ FROM TRANSACTIONS TABLE"); var sw = new Stopwatch(); sw.Start(); var transactions = new MassiveList <Transaction>(_connectionString, _tableName, _tablePkName); sw.Stop(); this.LogOutput("Read", transactions.Count, sw.ElapsedMilliseconds); return(transactions); }
public void MemoryDataExcercises(int qtyRecords) { // Start from fresh: this.DropTransctionTable(); this.CreateTransctionTable(); // Load the empty table: var transactions = new MassiveList <Transaction>(_connectionString, _tableName, _tablePkName); transactions.Clear(); var sw = new Stopwatch(); sw.Start(); // Insert a bunch of records: var data = this.getSkinnyTransactionSet(qtyRecords); transactions.AddRange(data); sw.Stop(); this.LogOutput("Wrote", qtyRecords, sw.ElapsedMilliseconds); transactions = this.ReadTransactionTable(); sw.Reset(); sw.Start(); // Find a record by arbitrary field (NOT the PK): var item = transactions.First(t => t.Identifier == "AA-9000"); sw.Stop(); this.LogOutput("Found single by field content", 1, sw.ElapsedMilliseconds); this.LogOutput("Found item: " + item.Identifier); sw.Reset(); sw.Start(); // Query against some criteria: var query = from t in transactions where (t.Amount > 100 && t.Amount < 150) select t; this.LogOutput("Read queried values from memory", query.Count(), sw.ElapsedMilliseconds); Console.WriteLine("Queried Values:"); foreach (var trans in query) { this.LogOutput("Id: " + trans.TransactionId + " Comment: " + trans.Comment + " Amount: " + trans.Amount); } sw.Stop(); this.LogOutput("Wrote queried values out to console", query.Count(), sw.ElapsedMilliseconds); }
public void MemoryDataExcercises(int qtyRecords) { // Start from fresh: this.DropTransctionTable(); this.CreateTransctionTable(); // Load the empty table: var transactions = new MassiveList<Transaction>(_connectionString, _tableName, _tablePkName); transactions.Clear(); var sw = new Stopwatch(); sw.Start(); // Insert a bunch of records: var data = this.getSkinnyTransactionSet(qtyRecords); transactions.AddRange(data); sw.Stop(); this.LogOutput("Wrote", qtyRecords, sw.ElapsedMilliseconds); transactions = this.ReadTransactionTable(); sw.Reset(); sw.Start(); // Find a record by arbitrary field (NOT the PK): var item = transactions.First(t => t.Identifier == "AA-9000"); sw.Stop(); this.LogOutput("Found single by field content", 1, sw.ElapsedMilliseconds); this.LogOutput("Found item: " + item.Identifier); sw.Reset(); sw.Start(); // Query against some criteria: var query = from t in transactions where (t.Amount > 100 && t.Amount < 150) select t; this.LogOutput("Read queried values from memory", query.Count(), sw.ElapsedMilliseconds); Console.WriteLine("Queried Values:"); foreach(var trans in query) { this.LogOutput("Id: " + trans.TransactionId + " Comment: " + trans.Comment + " Amount: " + trans.Amount); } sw.Stop(); this.LogOutput("Wrote queried values out to console", query.Count(), sw.ElapsedMilliseconds); }
public void ClearTransactionTable() { Console.WriteLine(Environment.NewLine); Console.WriteLine("CLEAR TRANSACTIONS TABLE"); var sw = new Stopwatch(); sw.Start(); var transactions = new MassiveList<Transaction>(_connectionString, _tableName, _tablePkName); int count = transactions.Count; sw.Stop(); this.LogOutput("Read", count, sw.ElapsedMilliseconds); sw.Reset(); sw.Start(); transactions.Clear(); sw.Stop(); this.LogOutput("Cleared", count, sw.ElapsedMilliseconds); }
public void WriteBulkTransactions(List <Transaction> newTransactions) { Console.WriteLine(Environment.NewLine); Console.WriteLine("WRITE BULK TRANSACTIONS"); int qty = newTransactions.Count; var sw = new Stopwatch(); sw.Start(); var transactions = new MassiveList <Transaction>(_connectionString, _tableName, _tablePkName); sw.Stop(); this.LogOutput("Read", transactions.Count, sw.ElapsedMilliseconds); sw.Reset(); sw.Start(); int added = transactions.AddRange(newTransactions); sw.Stop(); this.LogOutput("Wrote", newTransactions.Count, sw.ElapsedMilliseconds); }
public void ClearTransactionTable() { Console.WriteLine(Environment.NewLine); Console.WriteLine("CLEAR TRANSACTIONS TABLE"); var sw = new Stopwatch(); sw.Start(); var transactions = new MassiveList <Transaction>(_connectionString, _tableName, _tablePkName); int count = transactions.Count; sw.Stop(); this.LogOutput("Read", count, sw.ElapsedMilliseconds); sw.Reset(); sw.Start(); transactions.Clear(); sw.Stop(); this.LogOutput("Cleared", count, sw.ElapsedMilliseconds); }
public void SlowWriteTransactions(List <Transaction> newTransactions) { Console.WriteLine(Environment.NewLine); Console.WriteLine("WRITE LOOPED TRANSACTIONS"); var sw = new Stopwatch(); sw.Start(); int qty = newTransactions.Count; var transactions = new MassiveList <Transaction>(_connectionString, _tableName, _tablePkName); sw.Stop(); this.LogOutput("Read", transactions.Count, sw.ElapsedMilliseconds); sw.Reset(); sw.Start(); foreach (var newTransaction in newTransactions) { transactions.Add((Transaction)newTransaction); } sw.Stop(); this.LogOutput("Wrote", newTransactions.Count, sw.ElapsedMilliseconds); }
public MassiveList<Transaction> ReadTransactionTable() { Console.WriteLine(Environment.NewLine); Console.WriteLine("READ FROM TRANSACTIONS TABLE"); var sw = new Stopwatch(); sw.Start(); var transactions = new MassiveList<Transaction>(_connectionString, _tableName, _tablePkName); sw.Stop(); this.LogOutput("Read", transactions.Count, sw.ElapsedMilliseconds); return transactions; }
public void WriteBulkTransactions(List<Transaction> newTransactions) { Console.WriteLine(Environment.NewLine); Console.WriteLine("WRITE BULK TRANSACTIONS"); int qty = newTransactions.Count; var sw = new Stopwatch(); sw.Start(); var transactions = new MassiveList<Transaction>(_connectionString, _tableName, _tablePkName); sw.Stop(); this.LogOutput("Read", transactions.Count, sw.ElapsedMilliseconds); sw.Reset(); sw.Start(); int added = transactions.AddRange(newTransactions); sw.Stop(); this.LogOutput("Wrote", newTransactions.Count, sw.ElapsedMilliseconds); }
public void SlowWriteTransactions(List<Transaction> newTransactions) { Console.WriteLine(Environment.NewLine); Console.WriteLine("WRITE LOOPED TRANSACTIONS"); var sw = new Stopwatch(); sw.Start(); int qty = newTransactions.Count; var transactions = new MassiveList<Transaction>(_connectionString, _tableName, _tablePkName); sw.Stop(); this.LogOutput("Read", transactions.Count, sw.ElapsedMilliseconds); sw.Reset(); sw.Start(); foreach(var newTransaction in newTransactions) { transactions.Add((Transaction)newTransaction); } sw.Stop(); this.LogOutput("Wrote", newTransactions.Count, sw.ElapsedMilliseconds); }