Benchmarking 'table-loading' experience to share ...
Posted: Fri Aug 07, 2009 11:15 am
by Silver Springs ... >> Sun, 10 Oct 1999 22:23:29 GMT
Hi
I spent this morning optimising the loading of a table in my application to try and get better performance.
I use tables as my main interface for users selecting an instance to work with.
Having defined the columns required and set the text of the column headers (in row 1 - a fixed row) then I created a loop that generated some numbers and put them into 11 columns of each row.
A popular way (Way#1) of loading a table row (as done by default using the Form Wizard with tables) is to directly set the column # of each cell and then assign the appropriate text into each column cell e.g.
tbl_Test.column := 1;
tbl_Test.text := tbl_Text.row.String;
tbl_Test.column := 2;
tbl_Test.text := (tbl_Text.row+tbl_Test.column).String;
tbl_Test.column := 3;
tbl_Test.text := (tbl_Text.row+tbl_Test.column).String;
..... etc for all defined columns .............
Another way (Way#2) is to load the whole row at once rather than each individual table cell. This is more efficient and the savings can be substantial (see below). Your code would look something like :
tbl_Test.addItem(tbl_Text.row.String & Tab &
(tbl_Text.row+tbl_Test.column).String & Tab & (tbl_Text.row+tbl_Test.column+1).String & Tab & (tbl_Text.row+tbl_Test.column+2).String & Tab & ..... etc for all defined columns .............
(tbl_Text.row+tbl_Test.column+9).String);
When you put Way#2 into a called method then the results are as shown below.
Putting Way#2 directly into the loop generating the data (Way#3) reduces the calls to a separate method and gives even more time savings.
Hence I'm changing to Way#3 from now on.
Any comments as to further improve table-loading performance ????????????????
My benchmarking with 11 columns :
1000 rows 10000 rows
16000 rows (16000 max.in table allowed) ____________________________________________________________________________ _______
Way#1 4 secs 53 secs
103 secs
column-by
column defn.
Way#2 addItem 3 secs 30 secs
65 secs
in called method
Way#3 addItem 2 secs 29 secs
62 secs
directly in loop
SilverSprings ............................... silversprings@easyliving.com
Hi
I spent this morning optimising the loading of a table in my application to try and get better performance.
I use tables as my main interface for users selecting an instance to work with.
Having defined the columns required and set the text of the column headers (in row 1 - a fixed row) then I created a loop that generated some numbers and put them into 11 columns of each row.
A popular way (Way#1) of loading a table row (as done by default using the Form Wizard with tables) is to directly set the column # of each cell and then assign the appropriate text into each column cell e.g.
tbl_Test.column := 1;
tbl_Test.text := tbl_Text.row.String;
tbl_Test.column := 2;
tbl_Test.text := (tbl_Text.row+tbl_Test.column).String;
tbl_Test.column := 3;
tbl_Test.text := (tbl_Text.row+tbl_Test.column).String;
..... etc for all defined columns .............
Another way (Way#2) is to load the whole row at once rather than each individual table cell. This is more efficient and the savings can be substantial (see below). Your code would look something like :
tbl_Test.addItem(tbl_Text.row.String & Tab &
(tbl_Text.row+tbl_Test.column).String & Tab & (tbl_Text.row+tbl_Test.column+1).String & Tab & (tbl_Text.row+tbl_Test.column+2).String & Tab & ..... etc for all defined columns .............
(tbl_Text.row+tbl_Test.column+9).String);
When you put Way#2 into a called method then the results are as shown below.
Putting Way#2 directly into the loop generating the data (Way#3) reduces the calls to a separate method and gives even more time savings.
Hence I'm changing to Way#3 from now on.
Any comments as to further improve table-loading performance ????????????????
My benchmarking with 11 columns :
1000 rows 10000 rows
16000 rows (16000 max.in table allowed) ____________________________________________________________________________ _______
Way#1 4 secs 53 secs
103 secs
column-by
column defn.
Way#2 addItem 3 secs 30 secs
65 secs
in called method
Way#3 addItem 2 secs 29 secs
62 secs
directly in loop
SilverSprings ............................... silversprings@easyliving.com