TAChart: CustomChartSource optimization lazarus / 55-TAChart ---------------------------------------------------------------------- wp · 2011-09-04 15:08 Browsing through the source code of TAChart the following functions got my attention: Code: [Select]function TCustomChartSource.XOfMax: Double; var   i: Integer; begin   for i := 0 to Count - 1 do     with Item[i]^ do       if Y = Extent.b.Y then exit(X);   Result := 0.0; end; function TCustomChartSource.XOfMin: Double; var   i: Integer; begin   for i := 0 to Count - 1 do     with Item[i]^ do       if Y = Extent.a.Y then exit(X);   Result := 0.0; end;  Since Extent is a function iterating through all data items the XOfMin and XOfMax function may be speeded up by storing the result of Extent.a.Y in a local variable before entering the i loop. ---------------------------------------------------------------------- Ask · 2011-09-04 17:08 Caching should already be performed by the Extent function itself. ---------------------------------------------------------------------- wp · 2011-09-04 18:06 Fine.