McGod Posted August 26, 2006 Share Posted August 26, 2006 Alright, I have a Save function. though its REALLY slow, 7454 milliseconds. I want to try to speed it up expandcollapse popupFunc save () $timer = timerInit () Local $char, $S_Saveret, $S_tablenames, $check, $S_Saveam $char = GUICtrlRead ( $None ) If $char = "None" Then MsgBox ( 1, "Error", "You must load a config before saving!" ) Return EndIf _SQLite_Query ( -1, "SELECT * FROM " & $char & "_Character", $S_Saveret ) _SQLite_FetchNames ( $S_Saveret, $S_tablenames ) _SQLite_QueryFinalize ($S_Saveret) $i = 0 $S_Saveam = UBound ( $S_tablenames ) Dim $info[$S_Saveam] Do $info[$i] = GUICtrlRead ( $S_GUI[$i] ) Select Case $info[$i] = $GUI_CHECKED GUICtrlSetState ( $S_GUI[$i], "Yes" ) Case $info[$i] = $GUI_UNCHECKED GUICtrlSetState ( $S_GUI[$i], "No" ) EndSelect $check = _SQLite_Exec ( -1, "UPDATE " & $char & "_Character " & "SET " & $S_tablenames[$i] & "= '" & $info[$i] & "';" ) $i = $i + 1 Sleep (10) Until $i = $S_Saveam Local $G_Saveret, $G_tablenames, $G_Saveret, $G_Saveam, $info _SQLite_Query ( -1, "SELECT * FROM " & $char & "_Advanced", $G_Saveret ) _SQLite_Fetchnames ( $G_Saveret, $G_tablenames ) _SQLite_QueryFinalize ( $G_Saveret ) $i = 0 $G_Saveam = UBound ( $G_tablenames ) Do $info = GUICtrlRead ( $G_GUI[$i] ) If $info = $GUI_CHECKED Then GUICtrlSetState ( $S_GUI[$i], "Yes" ) ElseIf $info = $GUI_UNCHECKED Then GUICtrlSetState ( $S_GUI[$i], "No" ) EndIf _SQLite_Exec ( -1, "UPDATE " & $char & "_Advanced " & "SET " & $G_tablenames[$i] & "= '" & $info & "';" ) $i = $i + 1 Until $i = $G_Saveam $timed = timerDiff ( $timer ) MsgBox ( 1, "time", $timed ) If $check = $SQLite_OK Then MsgBox ( 1, "Save", "Saved '" & $char & "' sucessfully!" ) Else MsgBox ( 1, "Error", "Failed to save!" & @CRLF & _SQLite_ErrMsg () ) EndIf EndFunc Any suggestions? [indent][center][u]Formerly Chip[/u][/center]~UDFs~[/indent][u]IRC.au3 - Allows you to connect to IRC ServersINetCon.au3 - Connects/Disconnects/Check Status of InternetHardware Key - Creates a unique hardware hashScriptComm - Allows you to communicate between scripts using WM_COPYDATA[/u][indent]~Programs~[/indent][indent]SimonAu3ForumsIRC Bot~Web Site~Web Autoit Example[/indent][indent][b][/b][/indent][u][/u] Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted August 26, 2006 Moderators Share Posted August 26, 2006 Would help to know what this is for.... Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
McGod Posted August 26, 2006 Author Share Posted August 26, 2006 Would help to know what this is for.... Whoops sorry.This is a save function for a multi-config gui.You load a config and you save it with this. It uses SQLite to store data. [indent][center][u]Formerly Chip[/u][/center]~UDFs~[/indent][u]IRC.au3 - Allows you to connect to IRC ServersINetCon.au3 - Connects/Disconnects/Check Status of InternetHardware Key - Creates a unique hardware hashScriptComm - Allows you to communicate between scripts using WM_COPYDATA[/u][indent]~Programs~[/indent][indent]SimonAu3ForumsIRC Bot~Web Site~Web Autoit Example[/indent][indent][b][/b][/indent][u][/u] Link to comment Share on other sites More sharing options...
randallc Posted August 26, 2006 Share Posted August 26, 2006 Hi, In general, when using loops and calling sqlite, I have used sqlite3.exe and have been aware of the "overheads" with the command line calls. 2 or 3 answers; 1. I have therefore accumulated calls as strings and executed them at the end of a loop in 1 hit; so $_SQLite_Exec &="UPDATE " & $char & "_Character " & "SET " & $S_tablenames[$i]& "= '" & $info[$i] & "';"ends up having a whole lot of "update" lines separated by ";"before I actually call the " _SQLite_Exec (-1,$_SQLite_Exec)" Hope that makes sense ; I think it may apply to the speed of Piccaso's sqlite.dll version as well. [i have not done it with his version; the command line version would certainly do it if you wanted to use that; Picasso does have that in his commands as well as an option if the dll won't take it...] 2. I think it might be possible to do a more general "UPDATE" command which uses mmore effficient SQL commands; not sure depending on your data and db structure? 3. maybe others?... Best, Randall ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW Link to comment Share on other sites More sharing options...
Zedna Posted August 26, 2006 Share Posted August 26, 2006 3. maybe others?... Best, Randall Another one: from your Loop remove Sleep (10) Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
dandymcgee Posted August 26, 2006 Share Posted August 26, 2006 Zedna sleep(10) is ten miliseconds that won't change much - Dan [Website] Link to comment Share on other sites More sharing options...
Zedna Posted August 26, 2006 Share Posted August 26, 2006 (edited) Zedna sleep(10) is ten miliseconds that won't change much I know exactly what is it.But if somebody is optimizing for max. speed then no Sleep is desiredand mainly inside Loop. Edited August 26, 2006 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search 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