public object Create(object parent, object configContext, XmlNode section) { Benchmarks b = new Benchmarks(); if (section.Attributes["enabled"] != null) { bool enabled = b.Enabled; bool.TryParse(section.Attributes["enabled"].Value, out enabled); b.Enabled = enabled; } if (section.Attributes["minTime"] != null) { int minTime = b.MinTime.Milliseconds; int.TryParse(section.Attributes["minTime"].Value, out minTime); b.MinTime = TimeSpan.FromMilliseconds(minTime); } if (section.Attributes["queriesToTriggerLog"] != null) { int queries = b.QueriesToTriggerLog; int.TryParse(section.Attributes["queriesToTriggerLog"].Value, out queries); b.QueriesToTriggerLog = queries; } return b; }
/// <summary> /// Validates content - downloads files /// </summary> public string Validate(PlasmaDownloader.PlasmaDownloader downloader, bool waitForDownload) { if (!Benchmarks.Any()) { return ("No benchmarks selected - please add benchmarks (mutators/games) into Gaqmes or Benchmarks/games folder - in the folder.sdd format"); } if (!TestCases.Any()) { return("Please add test case runs using add button here"); } foreach (var bench in Benchmarks) { var ret = bench.Validate(downloader, waitForDownload); if (ret != null) { return(ret); } } foreach (var run in TestCases) { var ret = run.Validate(downloader, waitForDownload); if (ret != null) { return(ret); } } return("OK"); }
public override void OnResultExecuted(ResultExecutedContext filterContext) { TotalStopwatch.Stop(); Stopwatch.Stop(); long grandTotalMilliseconds = TotalStopwatch.ElapsedMilliseconds; long resultMilliseconds = Stopwatch.ElapsedMilliseconds; filterContext.RouteData.Values.TryGetValue(Controller, out object conName); filterContext.RouteData.Values.TryGetValue(Action, out object actName); string controllerName = conName as string ?? throw new Exception(); string actionName = actName as string ?? throw new Exception(); Benchmarks.Add(new ActionResultBenchmark( controllerName: controllerName, actionName: actionName, grandTotalMilliseconds: grandTotalMilliseconds, actionMilliseconds: TempNum, // more accurate to compared to subtracting "grandTotal" and "result" resultMilliseconds: resultMilliseconds)); (bool hasSaved, string filePath, string resultMessage) = FileSystemRepository.SaveJsonFile(BenchmarkName, Benchmarks); if (!hasSaved) { throw new Exception($"Error - log file not saved ({filePath}): {resultMessage}"); } }
private void DisplayResults() { foreach (var benchmark in Benchmarks.OrderBy(b => b.Stopwatch.ElapsedMilliseconds)) { Console.WriteLine("{0}: {1} ms -- {2} ms/iteration", benchmark.Name, benchmark.Stopwatch.ElapsedMilliseconds, ((double)benchmark.Stopwatch.ElapsedMilliseconds / (double)IterationCount)); } Console.WriteLine(); }
public static void Main(string[] args) { var testFixture = new Benchmarks(); double totalMs; var initialised = false; int total = 0; for (int i = 0; i < args.Length; i++) { if (int.TryParse(args[i], out total)) { initialised = true; break; } } if (!initialised) { total = 10; } if (args.Length == 0) { Console.Out.WriteLine("Native mapper conversion"); testFixture.SetUp(); totalMs = testFixture.BenchmarkNative(); Console.Out.WriteLine("Total elapsed time: {0}ms Total conversions: {1} Conversions: {2}/s".With( totalMs, Benchmarks.Total, 100 * Benchmarks.Total / totalMs)); } if (args.Length == 0 || args.Any(a => string.Equals(a, "delegate", StringComparison.CurrentCultureIgnoreCase))) { Console.Out.WriteLine("Transmute mapper conversion - Delegate"); for (int i = 0; i < total; i++) { testFixture.SetUp(); totalMs = testFixture.BenchmarkTransmute(MapBuilder.Delegate); Console.Out.WriteLine("Total elapsed time: {0}ms Total conversions: {1} Conversions: {2}/s".With(totalMs, Benchmarks.Total, 100 * Benchmarks.Total / totalMs)); } } if (args.Length == 0 || args.Any(a => string.Equals(a, "emit", StringComparison.CurrentCultureIgnoreCase))) { Console.Out.WriteLine("Transmute mapper conversion - Emit"); for (int i = 0; i < total; i++) { testFixture.SetUp(); totalMs = testFixture.BenchmarkTransmute(MapBuilder.Emit); Console.Out.WriteLine("Total elapsed time: {0}ms Total conversions: {1} Conversions: {2}/s".With(totalMs, Benchmarks.Total, 100 * Benchmarks.Total / totalMs)); } } }
private void RunBenchmarks() { var rand = new Random(); for (int i = 1; i <= IterationCount; i++) { foreach (var benchmark in Benchmarks.OrderBy(x => rand.Next())) { benchmark.Stopwatch.Start(); benchmark.Iteration(); benchmark.Stopwatch.Stop(); } } }
/// <summary> /// Añade la información de tiempo /// </summary> public void AddBenchmark(string message, TimeSpan elapsed, long records) { // Añade la información a la lista Benchmarks.Add(new JobBenchmarkModel { Job = ActualStep?.Job?.Name, Step = ActualStep?.Name, Title = message, Elapsed = elapsed, Records = records } ); // Escribe la información WriteInfo($"Benchmark\t{message}\tElapsed: {elapsed:HH:mm:ss.ms}\tRecords: {records}"); }
private static async Task DoCalculations() { try { await Task.Factory.StartNew(() => { long elapsed = Benchmarks.FillList(_numberCount, _threadCount); Console.WriteLine($"Calculated {_numberCount} numbers in {elapsed} ms"); }); } catch (Exception e) { Console.WriteLine(e); } }
void PostLoad(SpringPaths paths) { Benchmarks = Benchmarks.Select( x => Benchmark.GetBenchmarks(paths).SingleOrDefault(y => y.BenchmarkPath == x.BenchmarkPath) ?? Benchmark.GetBenchmarks(paths).First(y => y.Name == x.Name)).ToList(); foreach (var tr in TestCases) { tr.Config = Config.GetConfigs(paths).SingleOrDefault(x => x.ConfigPath == tr.Config.ConfigPath) ?? Config.GetConfigs(paths).First(x => x.Name == tr.Config.Name); tr.StartScript = StartScript.GetStartScripts(paths).SingleOrDefault(x => x.ScriptPath == tr.StartScript.ScriptPath) ?? StartScript.GetStartScripts(paths).First(x => x.Name == tr.StartScript.Name); } }
public Summary(string title, IList <BenchmarkReport> reports, HostEnvironmentInfo hostEnvironmentInfo, IConfig config, string resultsDirectoryPath, TimeSpan totalTime, ValidationError[] validationErrors) : this(title, hostEnvironmentInfo, config, resultsDirectoryPath, totalTime, validationErrors) { Benchmarks = reports.Select(r => r.Benchmark).ToArray(); foreach (var report in reports) { reportMap[report.Benchmark] = report; } Reports = Benchmarks.Select(b => reportMap[b]).ToArray(); orderProvider = config.GetOrderProvider() ?? DefaultOrderProvider.Instance; Benchmarks = orderProvider.GetSummaryOrder(Benchmarks, this).ToArray(); Reports = Benchmarks.Select(b => reportMap[b]).ToArray(); Table = GetTable(config.GetSummaryStyle()); shortInfos = new Dictionary <Job, string>(); jobs = new Lazy <Job[]>(() => Benchmarks.Select(b => b.Job).ToArray()); AllRuntimes = BuildAllRuntimes(); }
public override void Refresh() { //tags var selectedTags = Tags .Where(x => x.IsChecked) .Select(x => x.Item) .ToList(); Tags.Clear(); foreach (var checkItem in Context .Tags .OrderBy(x => x.Name) .ToList() .Select(x => new CheckListItem <Tag>(x, selectedTags.Contains(x)))) { Tags.Add(checkItem); } //strategies var selectedStrats = Strategies .Where(x => x.IsChecked) .Select(x => x.Item) .ToList(); Strategies.Clear(); foreach (var checkItem in Context .Strategies .OrderBy(x => x.Name) .ToList() .Select(x => new CheckListItem <Strategy>(x, selectedStrats.Contains(x)))) { Strategies.Add(checkItem); } //benchmarks Benchmarks.Clear(); foreach (Benchmark b in Context.Benchmarks.OrderBy(x => x.Name)) { Benchmarks.Add(b); } }
public Summary(string title, IList <BenchmarkReport> reports, EnvironmentHelper hostEnvironmentHelper, IConfig config, string currentDirectory, TimeSpan totalTime) { Title = title; HostEnvironmentHelper = hostEnvironmentHelper; Config = config; CurrentDirectory = currentDirectory; TotalTime = totalTime; Reports = new Dictionary <Benchmark, BenchmarkReport>(); Benchmarks = reports.Select(r => r.Benchmark).ToArray(); foreach (var report in reports) { Reports[report.Benchmark] = report; } TimeUnit = TimeUnit.GetBestTimeUnit(reports.Where(r => r.ResultStatistics != null).Select(r => r.ResultStatistics.Mean).ToArray()); Table = new SummaryTable(this); ShortInfos = new Dictionary <IJob, string>(); Jobs = new Lazy <IJob[]>(() => Benchmarks.Select(b => b.Job).ToArray()); }
public Summary(string title, IList <BenchmarkReport> reports, HostEnvironmentInfo hostEnvironmentInfo, IConfig config, string resultsDirectoryPath, TimeSpan totalTime, ValidationError[] validationErrors) : this(title, hostEnvironmentInfo, config, resultsDirectoryPath, totalTime, validationErrors) { Benchmarks = reports.Select(r => r.Benchmark).ToArray(); foreach (var report in reports) { reportMap[report.Benchmark] = report; } Reports = Benchmarks.Select(b => reportMap[b]).ToArray(); var orderProvider = config.GetOrderProvider() ?? DefaultOrderProvider.Instance; Benchmarks = orderProvider.GetSummaryOrder(Benchmarks, this).ToArray(); Reports = Benchmarks.Select(b => reportMap[b]).ToArray(); TimeUnit = TimeUnit.GetBestTimeUnit(reports.Where(r => r.ResultStatistics != null).Select(r => r.ResultStatistics.Mean).ToArray()); Table = new SummaryTable(this); shortInfos = new Dictionary <IJob, string>(); jobs = new Lazy <IJob[]>(() => Benchmarks.Select(b => b.Job).ToArray()); }
private static void RunBenchmarks() { new ListBenchmarks().Run(EzChartForm.StartOnNewThread(true)); Benchmarks.ConvexHull(); // Obtain the word list string wordList = Resources.WordList; string[] words = wordList.Split(new string[] { "\n", "\r\n" }, StringSplitOptions.RemoveEmptyEntries); Benchmarks.LinqVsForLoop(); //Benchmarks.CountOnes(); Benchmarks.BenchmarkSets(words); Benchmarks.ThreadLocalStorage(); Benchmarks.EnumeratorVsIterator(); GoInterfaceBenchmark.DoBenchmark(); CPTrieBenchmark.BenchmarkStrings(words); CPTrieBenchmark.BenchmarkInts(); Benchmarks.ByteArrayAccess(); }
public void Setup() { var benchmarks = new Benchmarks { // Json new BenchmarkSerializer(Benchmarks.BenderSerializer, Format.Json, x => new JsonNode(x), (n, t) => Bender.Deserializer.Create().Deserialize(n, t), x => Bender.Serializer.Create().SerializeNodes(x, (n, o) => new JsonNode(n.NodeType, new Options()), JsonNode.NodeFormat), x => x.Encode().ReadToEnd()), new BenchmarkSerializer("JavaScriptSerializer", Format.Json, (s, t) => new JavaScriptSerializer().Deserialize(s, t), x => new JavaScriptSerializer().Serialize(x)), new BenchmarkSerializer("DataContractJsonSerializer", Format.Json, (s, t) => new DataContractJsonSerializer(t).Deserialize(s, t), x => new DataContractJsonSerializer(x.GetType()).Serialize(x)), new BenchmarkSerializer("JSON.NET", Format.Json, JsonConvert.DeserializeObject, JsonConvert.SerializeObject), new BenchmarkSerializer("ServiceStack", Format.Json, JsonSerializer.DeserializeFromString, JsonSerializer.SerializeToString), new BenchmarkSerializer("fastJSON", Format.Json, (s, t) => JSON.Instance.ToObject(s, t), x => JSON.Instance.ToJSON(x, new JSONParameters { UseExtensions = false })), // Xml new BenchmarkSerializer(Benchmarks.BenderSerializer, Format.Xml, x => ElementNode.Parse(x, Options.Create()), (n, t) => Bender.Deserializer.Create().Deserialize(n, t), x => Bender.Serializer.Create().SerializeNodes(x, (n, o) => ElementNode.Create(n.Name, Metadata.Empty, Options.Create()), XmlNodeBase.NodeFormat), x => x.Encode().ReadToEnd()), new BenchmarkSerializer("XmlSerializer", Format.Xml, (s, t) => new XmlSerializer(t).Deserialize(s, t), x => new XmlSerializer(x.GetType()).Serialize(x)), new BenchmarkSerializer("DataContractSerializer", Format.Xml, (s, t) => new DataContractSerializer(t).Deserialize(s, t), x => new DataContractSerializer(x.GetType()).Serialize(x)), new BenchmarkSerializer("ServiceStack", Format.Xml, ServiceStack.Text.XmlSerializer.DeserializeFromString, ServiceStack.Text.XmlSerializer.SerializeToString) }; benchmarks.Run(typeof(Model<>), Format.Xml, "Performance/model.xml"); benchmarks.Run(typeof(Model<>), Format.Json, "Performance/model.json"); const string benchmarkPath = "Performance/Benchmarks/"; Console.Write(benchmarks.GetTextSummaryReport()); Console.WriteLine(); Console.Write(benchmarks.GetTextDetailReport()); Console.WriteLine(); Console.Write(benchmarks.GetTextDetailReport(benchmarkPath + "Report.Detail.txt")); benchmarks.SaveSummaryGraph(benchmarkPath + "All.png"); benchmarks.SaveSummaryGraph(benchmarkPath + "Cold.png", warm: false); benchmarks.SaveSummaryGraph(benchmarkPath + "Warm.png", false); benchmarks.SaveJsonSummaryReport(benchmarkPath + "Report.json"); benchmarks.SaveTextSummaryReport(benchmarkPath + "Report.txt"); benchmarks.SaveTextDetailReport(benchmarkPath + "Report.Detail.txt"); var results = benchmarks.GetResults().OrderBy(x => x.Name).ToList(); _xmlResults = results.Where(x => x.Format == Format.Xml).ToList(); _jsonResults = results.Where(x => x.Format == Format.Json).ToList(); }
public override async Task <Dictionary <BenchmarkResult, BenchmarkResult> > TryUpdateStatus(IEnumerable <BenchmarkResult> toModify, ResultStatus status) { if (toModify == null) { throw new ArgumentNullException(nameof(toModify)); } var mod = new Dictionary <BenchmarkResult, BenchmarkResult>(); foreach (var oldRes in toModify) { mod.Add(oldRes, null); } if (mod.Count == 0) { return(mod); } int n = Benchmarks.Length; var newBenchmarks = (BenchmarkResult[])Benchmarks.Clone(); var newAzureBenchmarks = new AzureBenchmarkResult[n]; for (int i = 0; i < n; i++) { var b = newBenchmarks[i]; if (mod.ContainsKey(b)) { if (b.Status != status) // updating status of this result { newBenchmarks[i] = new BenchmarkResult(b.ExperimentID, b.BenchmarkFileName, b.AcquireTime, b.NormalizedRuntime, b.TotalProcessorTime, b.WallClockTime, b.PeakMemorySizeMB, status, // <-- new status b.ExitCode, b.StdOut, b.StdErr, b.Properties); newAzureBenchmarks[i] = AzureExperimentStorage.ToAzureBenchmarkResult(newBenchmarks[i]); mod[b] = newBenchmarks[i]; } else // status is as required already { newAzureBenchmarks[i] = AzureExperimentStorage.ToAzureBenchmarkResult(b); mod.Remove(b); } } else // result doesn't change { newAzureBenchmarks[i] = AzureExperimentStorage.ToAzureBenchmarkResult(b); } } if (mod.Count == 0) { return(new Dictionary <BenchmarkResult, BenchmarkResult>()); // no changes } foreach (var item in mod) { if (item.Value == null) { throw new ArgumentException("Some of the given results to update do not belong to the experiment results"); } } bool success = await Upload(newAzureBenchmarks); if (!success) { return(null); } // Update benchmarks array Replace(newBenchmarks.ToArray()); return(mod); }
/// <summary> /// Instatiates a benchmark from the name and functions and adds /// it to the list. /// </summary> /// <param name="name"></param> /// <param name="Function"></param> public void AddBenchmark(string name, Func <double> function) { Benchmarks.Add(new Benchmark(name, function)); }
public sealed override void Benchmark() { Benchmarks.UpdateSize(gridView); }
public sealed override void Benchmark() { Benchmarks.UpdateSize(treeList); }
public override async Task <Dictionary <BenchmarkResult, BenchmarkResult> > TryUpdateStatus(IEnumerable <BenchmarkResult> toModify, ResultStatus status) { if (toModify == null) { throw new ArgumentNullException(nameof(toModify)); } var mod = new Dictionary <BenchmarkResult, BenchmarkResult>(); foreach (var oldRes in toModify) { mod.Add(oldRes, null); } if (mod.Count == 0) { return(mod); } int n = Benchmarks.Length; var newBenchmarks = (BenchmarkResult[])Benchmarks.Clone(); var newAzureBenchmarks = new AzureBenchmarkResult[n]; for (int i = 0; i < n; i++) { var b = newBenchmarks[i]; AzureBenchmarkResult azureResult; if (mod.ContainsKey(b)) { if (b.Status != status) // updating status of this result { newBenchmarks[i] = new BenchmarkResult(b.ExperimentID, b.BenchmarkFileName, b.AcquireTime, b.NormalizedCPUTime, b.CPUTime, b.WallClockTime, b.PeakMemorySizeMB, status, // <-- new status b.ExitCode, b.StdOut, b.StdErr, b.Properties); azureResult = ToAzureResult(newBenchmarks[i], TryGetExternalOutput(b)); mod[b] = newBenchmarks[i]; } else // status is as required already { azureResult = ToAzureResult(b, TryGetExternalOutput(b)); mod.Remove(b); } } else // result doesn't change { azureResult = ToAzureResult(b, TryGetExternalOutput(b)); } newAzureBenchmarks[i] = azureResult; } if (mod.Count == 0) { return(new Dictionary <BenchmarkResult, BenchmarkResult>()); // no changes } foreach (var item in mod) { if (item.Value == null) { throw new ArgumentException("Some of the given results to update do not belong to the experiment results"); } } string newEtag = await Upload(newAzureBenchmarks); if (newEtag == null) { return(null); } // Update benchmarks array etag = newEtag; Replace(newBenchmarks.ToArray()); foreach (var item in externalOutputs.ToArray()) { BenchmarkResult oldB = item.Key; BenchmarkResult newB; if (!mod.TryGetValue(oldB, out newB)) { continue; } AzureBenchmarkResult ar; if (externalOutputs.TryGetValue(oldB, out ar)) { externalOutputs.Remove(oldB); externalOutputs.Add(newB, ar); } } return(mod); }
public frmAccount(frmMain mf, Guid accountId, FormClosedEventHandler Close = null) { frmSplashScreen ss = new frmSplashScreen(); ss.Show(); Application.DoEvents(); InitializeComponent(); frmMain_Parent = mf; this.MaximumSize = Screen.PrimaryScreen.WorkingArea.Size; Application.AddMessageFilter(this); controlsToMove.Add(this.panel1); controlsToMove.Add(this.panel7); controlsToMove.Add(this.panel12); controlsToMove.Add(this.panel16); controlsToMove.Add(this.label1); controlsToMove.Add(this.label23); controlsToMove.Add(this.label30); controlsToMove.Add(this.label39); FormClosed += Close; loadObservationFields(); CurrentAccount = new Account(accountId); txtName.Text = CurrentAccount.Name; this.Text = CurrentAccount.Name; label18.Text = CurrentAccount.Name; label23.Text = CurrentAccount.Name; label30.Text = CurrentAccount.Name; txtEngagements.Text = CurrentAccount.Engagements; txtPrimaryContactName.Text = CurrentAccount.PrimaryContact.Name; txtPrimaryContactEmail.Text = CurrentAccount.PrimaryContact.Email; assetvalue.Text = CurrentAccount.Revenue; txtPhone.Text = CurrentAccount.Telephone; txtFax.Text = CurrentAccount.Fax; txtAddressLine1.Text = CurrentAccount.PrimaryAddress.Line1; txtAddressLine2.Text = CurrentAccount.PrimaryAddress.Line2; txtAddressCity.Text = CurrentAccount.PrimaryAddress.City; txtAddressState.Text = CurrentAccount.PrimaryAddress.State; txtAddressZip.Text = CurrentAccount.PrimaryAddress.Zip; txtCommitteeMembers.Text = CurrentAccount.CommitteeMembers; txtRecordKeepers.Text = CurrentAccount.RecordKeepers; txtCustodians.Text = CurrentAccount.Custodians; foreach (DataRow dr in ISP.Business.Entities.Plan.GetAssociatedFromAccount(accountId).Rows) { cboSelectedPlan.Items.Add(new Utilities.ListItem(dr["Name"].ToString(), dr["ID"].ToString())); } if (cboSelectedPlan.Items.Count > 0) { cboSelectedPlan.SelectedIndex = 0; } if (txtPrimaryContactName.Text == "" || txtPrimaryContactName.Text == null) { txtPrimaryContactName.Cursor = System.Windows.Forms.Cursors.Arrow; } comboBox5.Items.Clear(); comboBox6.Items.Clear(); comboBox5.Items.Add(new ListItem("No Instructions On File", null)); comboBox6.Items.Add(new ListItem("No Instructions On File", null)); foreach (DataRow dr in Benchmarks.Get().Rows) { comboBox5.Items.Add(new ListItem(dr["FundName"].ToString(), dr["FundID"].ToString())); comboBox6.Items.Add(new ListItem(dr["FundName"].ToString(), dr["FundID"].ToString())); } ss.Close(); this.Show(); }
public AseClientBenchmarks(Benchmarks <T> benchmark) { _benchmark = benchmark; _benchmark.SetUp(); }
public override async Task <bool> TryDelete(IEnumerable <BenchmarkResult> toRemove) { if (toRemove == null) { throw new ArgumentNullException(nameof(toRemove)); } var benchmarks = Benchmarks; var removeSet = new HashSet <BenchmarkResult>(toRemove); if (removeSet.Count == 0) { return(true); } int n = benchmarks.Length; List <AzureBenchmarkResult> newAzureResults = new List <AzureBenchmarkResult>(n); List <BenchmarkResult> newResults = new List <BenchmarkResult>(n); List <AzureBenchmarkResult> deleteOuts = new List <AzureBenchmarkResult>(); for (int i = 0; i < n; i++) { var b = benchmarks[i]; if (!removeSet.Contains(b)) // remains { var azureResult = ToAzureResult(b, TryGetExternalOutput(b)); newAzureResults.Add(azureResult); newResults.Add(b); } else // to be removed { removeSet.Remove(b); AzureBenchmarkResult ar; if (externalOutputs.TryGetValue(b, out ar)) { deleteOuts.Add(ar); } } } if (removeSet.Count != 0) { throw new ArgumentException("Some of the given results to remove do not belong to the experiment results"); } // Updating blob with results table string newEtag = await Upload(newAzureResults.ToArray()); if (newEtag == null) { return(false); } etag = newEtag; // Update benchmarks array Replace(newResults.ToArray()); (await storage.GetExperiment(ExperimentId)).CompletedBenchmarks = Benchmarks.Count(); // Deleting blobs with output foreach (var ar in deleteOuts) { try { var _ = storage.DeleteOutputs(ar); } catch (Exception ex) { Trace.WriteLine(string.Format("Exception when deleting output: {0}", ex)); } } return(true); }
public override void Refresh() { //tags var selectedTags = Tags .Where(x => x.IsChecked) .Select(x => x.Item) .ToList(); Tags.Clear(); foreach (var checkItem in Context .Tags .OrderBy(x => x.Name) .ToList() .Select(x => new CheckListItem <Tag>(x, selectedTags.Contains(x)))) { Tags.Add(checkItem); } //strategies var selectedStrats = Strategies .Where(x => x.IsChecked) .Select(x => x.Item) .ToList(); Strategies.Clear(); foreach (var checkItem in Context .Strategies .OrderBy(x => x.Name) .ToList() .Select(x => new CheckListItem <Strategy>(x, selectedStrats.Contains(x)))) { Strategies.Add(checkItem); } //Instruments if (Instruments.Count == 0) { //on first load we want all instruments selected, otherwise remember previous selection foreach (var checkItem in Context .Instruments .OrderBy(x => x.Symbol) .ToList() .Select(x => new CheckListItem <Instrument>(x, true))) { Instruments.Add(checkItem); } } else { var selectedInstruments = Instruments .Where(x => x.IsChecked) .Select(x => x.Item) .ToList(); Instruments.Clear(); foreach (var checkItem in Context .Instruments .OrderBy(x => x.Symbol) .ToList() .Select(x => new CheckListItem <Instrument>(x, selectedInstruments.Contains(x)))) { Instruments.Add(checkItem); } } //benchmarks Benchmarks.Clear(); foreach (Benchmark b in Context.Benchmarks.OrderBy(x => x.Name)) { Benchmarks.Add(b); } //backtest results from the external data source BacktestSeries.Clear(); if (Datasourcer.ExternalDataSource.Connected) { BacktestSeries.AddRange( Datasourcer .ExternalDataSource .GetBacktestSeries()); } }