laffo16 Posted November 15, 2008 Share Posted November 15, 2008 (edited) 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 November 15, 2008 by laffo16 Link to comment Share on other sites More sharing options...
dbzfanatic Posted November 15, 2008 Share Posted November 15, 2008 My personal opinion is #2. You don't have to know or check the data length you need and you always get the strings split properly. Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote] Link to comment Share on other sites More sharing options...
Valuater Posted November 15, 2008 Share Posted November 15, 2008 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 loop2) &= add feed into single string with seperater then stringsplit itthe 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 me8) Link to comment Share on other sites More sharing options...
laffo16 Posted November 15, 2008 Author Share Posted November 15, 2008 (edited) thanks guys, i'll do a quick test today & post my findings. Edited November 15, 2008 by laffo16 Link to comment Share on other sites More sharing options...
laffo16 Posted November 15, 2008 Author Share Posted November 15, 2008 (edited) 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 November 15, 2008 by laffo16 Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 15, 2008 Share Posted November 15, 2008 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. 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now