NiwatiX Posted October 18, 2015 Share Posted October 18, 2015 (edited) Hey guys, from a performance stand point, which one is best?FileWriteLine($sOpenfile,"some text1" & @CRLF) FileWriteLine($sOpenfile,"some text2" & @CRLF) FileWriteLine($sOpenfile,"some text3" & @CRLF) FileWriteLine($sOpenfile,"some text4" & @CRLF) Or this one FileWriteLine($sOpenfile,"some text1" & @CRLF & "some text2" & @CRLF & "some text3" & @CRLF & "some text4" & @CRLF &"some text5" & @CRLF) Also if second version is better, any way to split it on multiple line for readability inside the IDE? I'm a C programmer so usually white space isn't a problem out of string, I'm not used to that high level coding. I would assume second version is better since you call only once FileWriteLine, but you know sometime in the wrapper they optimize crazy things and I just want to be sure I'm not mistaken. Edited October 18, 2015 by NiwatiX Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 18, 2015 Moderators Share Posted October 18, 2015 NiwatiX,Why not write a quick script and see? Or do you expect someone else to do all the work for you?M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
NiwatiX Posted October 18, 2015 Author Share Posted October 18, 2015 NiwatiX,Why not write a quick script and see? Or do you expect someone else to do all the work for you?M23Well I expected someone to just.. know the answer. I'm sorry if you misunderstood my question, I don't want someone to build a script for me lol... I was wondering how things are aligned by the optimizer. Link to comment Share on other sites More sharing options...
Bowmore Posted October 18, 2015 Share Posted October 18, 2015 For future reference this is an example of how to test which of several different methods is the fastest.expandcollapse popup#include <FileConstants.au3> RunTests() Func RunTests() Local $sOpenfile = "c:\Temp\TessFile.txt" Local $Method1Timer = 0 Local $Method2Timer = 0 Local $Method3Timer = 0 $Method1Timer = TimerInit() Method1Test($sOpenfile) ConsoleWrite("Method 1 took " & TimerDiff($Method1Timer) & " milliseconds" & @CRLF ) $Method2Timer = TimerInit() Method2Test($sOpenfile) ConsoleWrite("Method 2 took " & TimerDiff($Method2Timer) & " milliseconds" & @CRLF ) $Method3Timer = TimerInit() Method3Test($sOpenfile) ConsoleWrite("Method 3 took " & TimerDiff($Method3Timer) & " milliseconds" & @CRLF ) EndFunc Func Method1Test($sOpenfile) FileWriteLine($sOpenfile,"some text1") FileWriteLine($sOpenfile,"some text2") FileWriteLine($sOpenfile,"some text3") FileWriteLine($sOpenfile,"some text5") FileWriteLine($sOpenfile,"some text6") FileWriteLine($sOpenfile,"some text7") FileWriteLine($sOpenfile,"some text8") FileWriteLine($sOpenfile,"some text9") FileWriteLine($sOpenfile,"some text10") EndFunc Func Method2Test($sOpenfile) FileWriteLine($sOpenfile,"some text1" & @CRLF & "some text2" & @CRLF & "some text3" & @CRLF & "some text4" & @CRLF & "some text5" & @CRLF & "some text6" & @CRLF & "some text7" & @CRLF & "some text8" & @CRLF & "some text9" & @CRLF & "some text10") EndFunc Func Method3Test($sOpenfile) Local $hFileHandel = FileOpen($sOpenfile,$FO_OVERWRITE+$FO_CREATEPATH ) FileWriteLine($hFileHandel,"some text1") FileWriteLine($hFileHandel,"some text2") FileWriteLine($hFileHandel,"some text3") FileWriteLine($hFileHandel,"some text4") FileWriteLine($hFileHandel,"some text5") FileWriteLine($hFileHandel,"some text6") FileWriteLine($hFileHandel,"some text7") FileWriteLine($hFileHandel,"some text8") FileWriteLine($hFileHandel,"some text9") FileWriteLine($hFileHandel,"some text10") FileClose($hFileHandel) EndFunc NiwatiX 1 "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook Link to comment Share on other sites More sharing options...
Gianni Posted October 18, 2015 Share Posted October 18, 2015 also...... any way to split it on multiple line for readability inside the IDE? .......to split long lines, you can use the underscore sign _ within the IDE:FileWriteLine($sOpenfile, "some text1" & @CRLF & _ "some text2" & @CRLF & _ "some text3" & @CRLF & _ "some text4" & @CRLF & _ "some text5" & @CRLF) NiwatiX 1 Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
NiwatiX Posted October 19, 2015 Author Share Posted October 19, 2015 Thanks guys for the tips, this is exactly what I was looking for 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