public static void WriteStudents(string path, IEnumerable <Stud> studs) { var saveWidth = Lentele.tableWidth; Lentele.tableWidth = 120; System.IO.StreamWriter file; try { file = new System.IO.StreamWriter(path); } catch (Exception) { return; } file.WriteLine(Lentele.GetFormatRow(false, "Pavarde", "Vardas", "ND1", "ND2", "ND3", "ND4", "ND5")); foreach (var stud in studs) { file.WriteLine(Lentele.GetFormatRow(false, stud.GetData(Stats.Grades))); } file.Close(); Lentele.tableWidth = saveWidth; }
public static void RunContainerBenchmark(int size) { Lentele.tableWidth = 80; System.Console.WriteLine($"Student list size: {size}"); System.Console.WriteLine(Lentele.GetFormatRow(false, "Container", "Init", "Split", "Sort", "Write")); System.Console.WriteLine(Lentele.GetLine()); System.Console.WriteLine(Lentele.GetFormatRow(false, FormatTimeSpans(TestList(size)).Prepend("List").ToArray())); System.Console.WriteLine(Lentele.GetFormatRow(false, FormatTimeSpans(TestLinkedListLast(size)).Prepend("LinkedList").ToArray())); System.Console.WriteLine(Lentele.GetFormatRow(false, FormatTimeSpans(TestQueueElementAt(size)).Prepend("Queue").ToArray())); }
public static void RunAdvanceBenchmark(int size) { Lentele.tableWidth = 100; System.Console.WriteLine($"Student list size: {size}"); System.Console.WriteLine(Lentele.GetFormatRow(false, "Strategy", "Init", "Split", "Sort", "Write")); System.Console.WriteLine(Lentele.GetLine()); System.Console.WriteLine(Lentele.GetFormatRow(false, FormatTimeSpans(TestList(size)).Prepend("List/NoDel").ToArray())); System.Console.WriteLine(Lentele.GetFormatRow(false, FormatTimeSpans(TestListDel(size)).Prepend("List/WithDel").ToArray())); System.Console.WriteLine(Lentele.GetFormatRow(false, FormatTimeSpans(TestLinkedListFirst(size)).Prepend("LinkedList/DelFirst").ToArray())); System.Console.WriteLine(Lentele.GetFormatRow(false, FormatTimeSpans(TestLinkedListLast(size)).Prepend("LinkedList/DelLast").ToArray())); System.Console.WriteLine(Lentele.GetFormatRow(false, FormatTimeSpans(TestQueue(size)).Prepend("Queue/First").ToArray())); System.Console.WriteLine(Lentele.GetFormatRow(false, FormatTimeSpans(TestQueueElementAt(size)).Prepend("Queue/ElementAt").ToArray())); }
public static void RunBenchmark() { Lentele.tableWidth = 80; var sizes = new List <int>() { 1000, 10000, 100000, 1000000, 10000000 }; System.Console.WriteLine(Lentele.GetFormatRow(false, "Stud sk", "Init", "Split", "Sort", "Write #1", "Write #2")); System.Console.WriteLine(Lentele.GetLine()); foreach (var i in sizes) { var times = ExecuteBencmark(i); var data = new List <string>() { $"{i}" }; data.AddRange(FormatTimeSpans(times)); System.Console.WriteLine(Lentele.GetFormatRow(false, data.ToArray())); } }