Support Board
Date/Time: Thu, 06 Mar 2025 16:08:31 +0000
Post From: ACS Drawing Recalculation Performance
[2022-02-03 19:28:53] |
User907968 - Posts: 836 |
Any possibility to comment further? Here is another example test code, nothing complicated, short calculation/recalculation time - consistently ~1ms. However, add two more copies of the study to simulate different studies using ACS drawings, recalculation time consistently >300ms (per study). How can I determine the reason, when it must be happening outside of the study code? SCSFExport scsf_ChartDrawingTest(SCStudyInterfaceRef sc) { auto& in_MaxDrawings = sc.Input[0]; auto& in_DrawingFrequency = sc.Input[1]; if (sc.SetDefaults) { sc.GraphName = "ACS Chart Drawing Test"; sc.GraphRegion = 0; sc.AutoLoop = 0; sc.ValueFormat = VALUEFORMAT_INHERITED; sc.GlobalDisplayStudySubgraphsNameAndValue = 0; sc.DisplayStudyInputValues = 0; sc.HideDLLAndFunctionNames = 1; in_MaxDrawings.Name = "Max Drawing Count"; in_MaxDrawings.SetInt(1000); in_MaxDrawings.SetIntLimits(1, 50000); in_DrawingFrequency.Name = "Bars Between Drawings"; in_DrawingFrequency.SetInt(10); in_DrawingFrequency.SetIntLimits(5, 50); return; } for (auto barIndex = sc.UpdateStartIndex; barIndex < sc.ArraySize; barIndex++) { if (barIndex % in_DrawingFrequency.GetInt() != 0 || sc.HideStudy) continue; if (sc.GetACSDrawingsCount(sc.ChartNumber, 1) >= in_MaxDrawings.GetInt()) break; if (sc.GetBarHasClosedStatus(barIndex) == BHCS_BAR_HAS_CLOSED) { auto rectangle = s_UseTool(); rectangle.ChartNumber = sc.ChartNumber; rectangle.Region = sc.GraphRegion; rectangle.AddMethod = UTAM_ADD_ALWAYS; rectangle.BeginValue = sc.Low[barIndex]; rectangle.EndValue = sc.High[barIndex]; rectangle.BeginIndex = barIndex; rectangle.EndIndex = barIndex + 10; rectangle.DrawUnderneathMainGraph = sc.DrawStudyUnderneathMainPriceGraph; rectangle.DrawingType = DRAWING_RECTANGLEHIGHLIGHT; rectangle.Color = COLOR_BLUE; rectangle.SecondaryColor = COLOR_RED; rectangle.LineStyle = LINESTYLE_SOLID; rectangle.LineWidth = 1; rectangle.TransparencyLevel = sc.TransparencyLevel; sc.UseTool(rectangle); } } if (sc.UpdateStartIndex == 0) { const auto hidden = sc.HideStudy ? "Hidden" : "Visible"; auto msg = SCString(); msg.AppendFormat("Study ID: %d is %s | ", sc.StudyGraphInstanceID, hidden); msg.AppendFormat("Drawings Added by Study: %d | ", sc.GetACSDrawingsCount(sc.ChartNumber, 1)); msg.AppendFormat("Total Drawings for All Studies: %d | ", sc.GetACSDrawingsCount(sc.ChartNumber, 0)); msg.AppendFormat("Last Calculation Time: %d", sc.LastFullCalculationTimeInMicroseconds); sc.AddMessageToLog(msg, 1); } } |