You are not logged in.
Hello and thanks.
The following statements are very slow, for a json that has 300 records. It takes a few seconds:
DataSource1.DataSet := nil;
OrmTableDataSet.Close;
OrmTableDataSet.Free;
OrmTableDataSet := TOrmTableDataSet.CreateFromJson(nil , json);
DataSource1.DataSet := OrmTableDataSet;
Last edited by anouri (2024-04-05 07:31:58)
Offline
Try to debug a little and see where it is slow.
Close? Free? Assigning to DataSet? CreateFromJson?
Which compiler are you using?
My guess is it is in the VCL, not mORMot.
TOrmTableDataSet is just a wrapper around TDataSet with a TOrmTable which is very very fast (and daily validated/tested as such).
Offline
I debugged it, closing is slow.
But you are right. I changed my code and sloved I don't khow why!!!!
vwMain.BeginUpdate(); //cxgrid
//DataSource1.DataSet := nil;
Last edited by anouri (2024-04-05 10:03:08)
Offline
Grid control is slow in adding records one by one, when you call BeginUpdate (and EndUpdate at the end) you're telling grid not to add/repaint record one by one but rather create all and then do a repaint. Perhaps a bit better (if you have multiple controls associated with table) Dataset.Disable(Enable)Controls
https://docwiki.embarcadero.com/Librari … leControls
Offline
I know, but the interesting thing is why the speed is still low when datasource is set to nil. But when beginupdate is executed, the problem is solved.
Offline