dobbelina Posted May 8, 2010 Share Posted May 8, 2010 What goes faster/requires less computing ? Checking for the existence of a file, and then delete it. or simply do a FileDelete without checking it's presence... Link to comment Share on other sites More sharing options...
czardas Posted May 8, 2010 Share Posted May 8, 2010 (edited) FileDelete without checking will be faster, though you may wish to check that no errors have occured, during deletion. Edited May 8, 2010 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
GEOSoft Posted May 8, 2010 Share Posted May 8, 2010 (edited) Checking for FileDelete can also be done without checking FileExists() If FileDelete("c:\some\file.ext") Then ;; Do something Else ;; Do something else because the file was not deleted or did not exist. EndIf Edit: I should also make you aware of this. Unless you are checking at least hundreds of files with FileExists() OR you are running an old 286 system with about 4Mb of RAM on Win 3.1, then the time saving will not be noticable. For example, the time it takes to check the existence of 30 files will be less than the time it takes for a blink of the eye. You're talking micro-seconds here. Edited May 8, 2010 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
dobbelina Posted May 8, 2010 Author Share Posted May 8, 2010 Ok, thanks for the replys. At the moment i'm trying to optimize my code, after getting it to work the way i want. I realized that some stuff could be put into functions, that gets accessed with Call, only when needed. Other stuff wasn't needed (shuffling the code around), so i stripped that away. Any tips on optimizing is always nice. Link to comment Share on other sites More sharing options...
GEOSoft Posted May 8, 2010 Share Posted May 8, 2010 Avoiding call is a good start. Why on earth would you want to use Call("myfunc", $sParam), when you can just use MyFunc($sParam)? There are times when Call can be handy but normalally it's better to access a function by the second method. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
dobbelina Posted May 8, 2010 Author Share Posted May 8, 2010 Thanks ! I'm learning here. As you can see, i still haven't got rid of the "goto" bug from bat scripting Link to comment Share on other sites More sharing options...
Shafayat Posted May 8, 2010 Share Posted May 8, 2010 (edited) Another useful tip when dealing with files of importance. Especially when debugging.if @compiled then filedelete(myfilehere) else filerecycle(myfilehere) endifthis can help you not to loose important files or having to copy or create them again. Edited May 8, 2010 by Shafayat [Not using this account any more. Using "iShafayet" instead] Link to comment Share on other sites More sharing options...
GEOSoft Posted May 8, 2010 Share Posted May 8, 2010 Thanks !I'm learning here.As you can see, i still haven't got rid of the "goto" bug from bat scripting GoTo and GoSub rode out on the back of a dinosaur and Call should have gone with them. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" 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