|
Post by deaconjim on Aug 5, 2020 7:20:59 GMT -5
I have a program that loads an array() and then displays it in a TextBox after sorting the array(). It seems to be very slow (4 to 5 seconds for 300 records). Is there a faster way?
|
|
|
Post by deaconjim on Aug 5, 2020 7:22:16 GMT -5
Sorry, that is a ListBox, not TextBox
|
|
|
Post by tsh73 on Aug 5, 2020 11:06:52 GMT -5
Check your codes, or see mine On my box sorting and reloading 3000 lines takes 6 ms You can time different parts of your code (file reading, sorting, reloading)
N=300'0 dim a$(N)
for i = 1 to N a$(i) = chr$(65+rnd(0)*26);int(rnd(0)*10000000);chr$(65+rnd(0)*26) next
'------------------------------------ ' Form created with the help of Freeform-J v.261006 ' Generated on Aug 05, 2020 at 19:00:20
nomainwin
WindowWidth = 550 WindowHeight = 410
UpperLeftX=int((DisplayWidth-WindowWidth)/2) UpperLeftY=int((DisplayHeight-WindowHeight)/2)
listbox #main.listbox1, a$(, [listbox1DoubleClick], 26, 16, 208, 335 button #main.button2, "Button Caption", [button2Click], UL, 270, 16, 122, 25 open "untitled" for window as #main print #main, "trapclose [quit.main]"
print #main, "font ms_sans_serif 10"
wait
[quit.main] Close #main END
[listbox1DoubleClick] 'Perform action for the listbox named 'listbox1' 'Insert your own code here wait
[button2Click] 'Perform action for the button named 'button2' for i = 1 to N a$(i) = chr$(65+rnd(0)*26);int(rnd(0)*10000000);chr$(65+rnd(0)*26) next
for i = 1 to N print a$(i) next
t0=time$("ms") sort a$(),1, N t1=time$("ms") print for i = 1 to N print a$(i) next #main.listbox1, "reload" notice "time taken ";t1-t0
wait
|
|
|
Post by honkytonk on Aug 6, 2020 1:22:10 GMT -5
The display takes longer than the calculations.
|
|