Jump to content

Array Redim or Stringsplit? (_SQLite_FetchData)


laffo16
 Share

Recommended Posts

hi guys, im curious which is the quickest method when feeding a realy large ammount of data into an array.

1) redim the array to last entry of feed then add data via For loop

2) &= add feed into single string with seperater then stringsplit it

the result is the same, but is one quicker then the other? appologies if this has already been discussed.

i know arrays can be funny things when it comes to speed, you have to create them properly.

im looking at _SQLite_FetchData wondering if method 2) would prove quicker then method 1)

i guess it boils down to what is quicker, combining strings (+ split) or writing into an array (+ redim)?

Edited by laffo16
Link to comment
Share on other sites

Link to comment
Share on other sites

hi guys, im curious which is the quickest method when feeding a realy large ammount of data into an array.

1) redim the array to last entry of feed then add data via For loop

2) &= add feed into single string with seperater then stringsplit it

the result is the same, but is one quicker then the other? appologies if this has already been discussed.

i know arrays can be funny things when it comes to speed, you have to create them properly.

im looking at _SQLite_FetchData wondering if method 2) would prove quicker then method 1)

i guess it boils down to what is quicker, combining strings (+ split) or writing into an array (+ redim)?

Normal, I find myself using stringSplit on an array of data

.. quicker for me

8)

NEWHeader1.png

Link to comment
Share on other sites

so i did some tests with _SQLite_FetchData and changed $aRow[$i] = $sRval[0] to $aRow &= "|" & $sRval[0] and it seems the string method is the slightly faster but not by any great deal.

1) scores: 0.435 ms

2) scores: 0.405 ms

commenting the first line of _SQLite_FetchData, ";If Not __SQLite_hChk($hQ.....", can save 0.05 ms

any ideas on a faster method for calling and dumping the results into an array?

is it possible to have "DllCall($g_hDll_SQLite....)" return more then one result per call?

::larger sample test::

_SQLite_FetchData_mod*: 5.357

_SQLite_FetchData_mod**: 6.255

_SQLite_FetchData: 6.519

_SQLite_GetTable: 7.229

_SQLite_Exec: 7.412

_SQLite_GetTable2d: 7.487

*mod includes &= string method and commented first line.

**mod includes &= string method

in summary _SQLite_FetchData is quicker then _SQLite_GetTable & _SQLite_Exec for gathering data into a single diminsion arr.

Edited by laffo16
Link to comment
Share on other sites

so i did some tests with _SQLite_FetchData and changed $aRow[$i] = $sRval[0] to $aRow &= "|" & $sRval[0] and it seems the string method is the slightly faster but not by any great deal.

1) scores: 0.435 ms

2) scores: 0.405 ms

commenting the first line of _SQLite_FetchData, ";If Not __SQLite_hChk($hQ.....", can save 0.05 ms

any ideas on a faster method for calling and dumping the results into an array?

is it possible to have "DllCall($g_hDll_SQLite....)" return more then one result per call?

::larger sample test::

_SQLite_FetchData_mod*: 5.357

_SQLite_FetchData_mod**: 6.255

_SQLite_FetchData: 6.519

_SQLite_GetTable: 7.229

_SQLite_Exec: 7.412

_SQLite_GetTable2d: 7.487

*mod includes &= string method and commented first line.

**mod includes &= string method

in summary _SQLite_FetchData is quicker then _SQLite_GetTable & _SQLite_Exec for gathering data into a single diminsion arr.

Did you try _SQLite_GetTable2d()? You might look at the code for that function inside the SQLite.au3 UDF for more hints.

:mellow:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...