Perpeto 5 Posted April 26 I have a test application, where i only have a TColorBox-Component. If I change the style in any way, it takes ~20ms to initialise. In Delphi11 it's faster than in Delphi12, because Delphi12 has more Colors in "System.UIConsts". In our "real" application we do have some dialogs with 20 or more coloroboxes, which adds up to 700ms per Dialog only to initialize those colorboxes. We assume, that the issue is in TCustomColorBox.PopulateList or more preciseley "TCustomColorBox.ColorCallBack". Does anyone have tips how to speed things up or what i do wrong here? Thanks! unit colorbox_performance; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls; type TForm22 = class(TForm) ColorBox1: TColorBox; procedure FormShow(Sender: TObject); end; var Form22: TForm22; implementation uses diagnostics; {$R *.dfm} { TForm22 } procedure TForm22.FormShow(Sender: TObject); begin var StopWatch := TStopwatch.StartNew; ColorBox1.Style := ColorBox1.Style - [cbStandardColors]; ShowMessage(format('%dms', [round(StopWatch.Elapsed.TotalMilliseconds)])); end; . Share this post Link to post
dwrbudr 8 Posted April 27 If all or most of the comboboxes need to be populated with the same items, then cache the Items of one combobox to a TStringList. Then use ColorBox1.Items := CachedColorItems instead of setting its Style. On my side it increases the performance from 20ms to 15ms Share this post Link to post