DataStore vs. DataWindows Performance Tests

The following function was used to perform 5 performance tests. Please see comments in the code for test descriptions. Actual numbers depend on the system configuration and will be different on your PC, however the test clearly shows that a visible DataWindow with SetRedraw(False) performs even better than a DataStore. The test was done on  Pentium PRO 200, 32 MB RAM, running Windows 95 and PowerBuilder 6.5. The window w_datastore was a simple window of main type with just one datawindow control on it. The attached datawindow object had 58 columns and some expressions.

long    ll_start1, ll_end1, &
        ll_start2, ll_end2, &
        ll_start3, ll_end3, &
        ll_start4, ll_end4, &
        ll_start5, ll_end5
integer i

// test 1 - visible window and datawindow on it
open(w_datastore)
ll_start1 = cpu()
for i = 1 to 1000
    w_datastore.dw_1.InsertRow(0)
next
ll_end1 = cpu()
close(w_datastore)


// test 2 - invisible window and datawindow on it
open(w_datastore)
hide(w_datastore)
ll_start2 = cpu()
for i = 1 to 1000
    w_datastore.dw_1.InsertRow(0)
next
ll_end2 = cpu()
close(w_datastore)

// test 3 - visible window and invisible datawindow on it
open(w_datastore)
hide(w_datastore.dw_1)
ll_start3 = cpu()
for i = 1 to 1000
    w_datastore.dw_1.InsertRow(0)
next
ll_end3 = cpu()
close(w_datastore)

// test 4 - visible window and datawindow with no redraw on it
open(w_datastore)
w_datastore.dw_1.SetRedraw(False)
ll_start4 = cpu()
for i = 1 to 1000
    w_datastore.dw_1.InsertRow(0)
next
ll_end4 = cpu()
close(w_datastore)


// test 5 - datastore
datastore ds_1
ds_1 = CREATE datastore
ds_1.DataObject = "d_test"
ll_start5 = cpu()
for i = 1 to 1000
    ds_1.InsertRow(0)
next
ll_end5 = cpu()
DESTROY ds_1


// display results
MessageBox("Results",     "Test 1: " + string((ll_end1 - ll_start1)/1000) + "~r~n" + &
                          "Test 2: " + string((ll_end2 - ll_start2)/1000) + "~r~n" + &
                          "Test 3: " + string((ll_end3 - ll_start3)/1000) + "~r~n" + &
                          "Test 4: " + string((ll_end4 - ll_start4)/1000) + "~r~n" + &
                          "Test 5: " + string((ll_end5 - ll_start5)/1000) )

msgbox.gif (2481 bytes)