Tlem Posted June 14, 2009 Share Posted June 14, 2009 Hello everybody. In my search of filelist function, I read the File.au3 UDF to see how _FileListToArray was writing. And in the code I saw that it work directly with array. I noticed that this approach is slower than using strings and create the array in the end. So, this is what I noticed on my laptop IBM R60 : If I use standard _FileListToArray function, the time to do the trip on my @SystemDir is about : 49ms If I modify the function to use strings, the time decreases to 32ms. Well, 17ms isn't a long time, but my @SystemDir contains only 2497 elements. For information, I make a test on my @WindowsDir (211 elements), and the difference between time is only of 1ms. I don't know if it's a good idea to make the modification, but I put it here in case of. Func _FileListToArray($sPath, $sFilter = "*", $iFlag = 0) Local $hSearch, $sFile, $sFileList, $asFileList[1] If Not FileExists($sPath) Then Return SetError(1, 1, "") If (StringInStr($sFilter, "\")) Or (StringInStr($sFilter, "/")) Or (StringInStr($sFilter, ":")) Or (StringInStr($sFilter, ">")) Or (StringInStr($sFilter, "<")) Or (StringInStr($sFilter, "|")) Or (StringStripWS($sFilter, 8) = "") Then Return SetError(2, 2, "") If Not ($iFlag = 0 Or $iFlag = 1 Or $iFlag = 2) Then Return SetError(3, 3, "") If (StringMid($sPath, StringLen($sPath), 1) = "\") Then $sPath = StringTrimRight($sPath, 1); needed for Win98 for x:\ root dir $hSearch = FileFindFirstFile($sPath & "\" & $sFilter) If $hSearch = -1 Then Return SetError(4, 4, "") While 1 $sFile = FileFindNextFile($hSearch) If @error Then SetError(0) ExitLoop EndIf If $iFlag = 1 And StringInStr(FileGetAttrib($sPath & "\" & $sFile), "D") <> 0 Then ContinueLoop If $iFlag = 2 And StringInStr(FileGetAttrib($sPath & "\" & $sFile), "D") = 0 Then ContinueLoop $sFileList &= $sFile & "|" WEnd FileClose($hSearch) $asFileList = StringSplit(StringTrimRight($sFileList, 1), "|") Return $asFileList EndFunc ;==>_FileListToArray Best Regards.Thierry Link to comment Share on other sites More sharing options...
Zedna Posted June 16, 2009 Share Posted June 16, 2009 It sounds good to me. I think this is good idea. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
BrettF Posted June 16, 2009 Share Posted June 16, 2009 There is a limit with string length though isn't there? What happens if we reach that limit? Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Zedna Posted June 16, 2009 Share Posted June 16, 2009 There is a limit with string length though isn't there? What happens if we reach that limit?I think it's 2GB (or amount of addressable RAM in OS limit) so it shouldn't be problem. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Richard Robertson Posted June 16, 2009 Share Posted June 16, 2009 A large string can still become cumbersome to process. Remember that when appending a string, a copy has to be made to append to. Link to comment Share on other sites More sharing options...
jpm Posted June 16, 2009 Share Posted June 16, 2009 $sFileList &= $sFile & "|" This statement will do a lot of memory allocation/deallocation so I suggest that for this small improvement we don't change it. Link to comment Share on other sites More sharing options...
Zedna Posted June 16, 2009 Share Posted June 16, 2009 $sFileList &= $sFile & "|" This statement will do a lot of memory allocation/deallocation so I suggest that for this small improvement we don't change it. In original function there is ReDim $asFileList[uBound($asFileList) + 1] inside loop which does lot of memory allocation/deallocation too. So developers should consider which of thouse is better. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Valik Posted June 16, 2009 Share Posted June 16, 2009 You guys are really starting to annoy me with this function. Everybody has an opinion on how this function should behave or should be implemented. Shut up and use what you have. We will never see the end of revisions if you want to tweak it because there will always be somebody better than you who can come along and make it "better". Link to comment Share on other sites More sharing options...
GEOSoft Posted June 16, 2009 Share Posted June 16, 2009 You guys are really starting to annoy me with this function. Everybody has an opinion on how this function should behave or should be implemented. Shut up and use what you have. We will never see the end of revisions if you want to tweak it because there will always be somebody better than you who can come along and make it "better".I'm beginining to think that no UDFs should be included with AutoIt. Let people write their own versions and post them on Example Scripts. This is becoming a never ending problem. 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...
Valik Posted June 16, 2009 Share Posted June 16, 2009 I'm beginining to think that no UDFs should be included with AutoIt. Let people write their own versions and post them on Example Scripts. This is becoming a never ending problem.People just need to get it through their stupid heads that we dot not have to do everything for them. If they can make modifications to something they need to shut the fuck up and use it. Or post it on the forum if they want to share. A significant amount of community feedback can drive feature change but not one random person saying "hey I can do that better". Link to comment Share on other sites More sharing options...
GEOSoft Posted June 16, 2009 Share Posted June 16, 2009 I'm probably still running in PMS mode but to me these posts are becoming a nuisance in general. 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...
Zedna Posted June 16, 2009 Share Posted June 16, 2009 @Valik No need to be rude here. Just say: "It will not be done in any way" and we will understand that :-) Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Valik Posted June 16, 2009 Share Posted June 16, 2009 Zedna, it's frustrating. People aren't happy they can do something. It must be built-in or at least in a UDF distributed by us. It's absurd how some people can't use code unless we are somehow involved with the distribution of it. Link to comment Share on other sites More sharing options...
JSThePatriot Posted June 16, 2009 Share Posted June 16, 2009 Probably the need to feel special, the want to have contributed something to such an amazing product. Neither are really bad traits, but agreed it should be done through feedback. That's how I've gotten my UDF's included. Yet they have I believe all been changed/upgraded/fixed but it also was done through the community and tried over and over again before it was included in the actual UDF releases. People don't understand the concept of using the community to test. Not just simply saying I think this is better for this theoretical reason. Prove it. Have more than yourself as proof. Then it may still be declined on the concept of this function is good enough for general consumption. Oh well...GEOSoft...buddy they make Midol for that PMS stuff you're referencing Jarvis AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
KaFu Posted June 16, 2009 Share Posted June 16, 2009 Hmmm, but Tlem still points a valid argument imho. The UDFs (and examples; and examples of normal functions as well) are not always the 'most efficient' one's or in some cases even up-to-date. Guys, no offense meant, we all do this in our spare time... just an idea throw into the ring, might a (tightly moderated) UDF/Function Wiki be a... not solution, but improvement? The articles get a release stamp and on new releases creating a .chm file from the wiki should be possible... OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Tlem Posted June 16, 2009 Author Share Posted June 16, 2009 I am really sorry to have started such a reaction while my purpose was to participate like some other. My knowledge being very limited, so I believed to make by exposing the result of my researches and tests. I would never have imagined such a rude reaction. It makes 3 times that I try to participate and 3 times the reaction of developers in summer inequitable. So in the future, I would keep my reflections for the French forum and as 80 % of the users of this program and forum, I would take without giving (here). Thus, forgive my cheek, I would see to it not to begin again any more. Best Regards.Thierry Link to comment Share on other sites More sharing options...
Zedna Posted June 16, 2009 Share Posted June 16, 2009 Tlem if you know this forum better you would know Valik is quite rude/not friendly/pesimistic almost all the time.So don't take it personally. It's just the fact: One of the developers is not so friendly as others here.Now I'm a bit scarred because of my ticket related to _FileListToArray() :-)http://www.autoitscript.com/trac/autoit/ticket/966 Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
evilertoaster Posted June 16, 2009 Share Posted June 16, 2009 I would never have imagined such a rude reaction.Tlem if you know this forum better you would know Valik is quite rude/not friendly/pesimistic almost all the time.So don't take it personally. It's just the fact: One of the developers is not so friendly as others here.It's quite well documented as one of the forums only 2 FAQ's-http://www.autoitscript.com/forum/index.php?showtopic=37739Do take it personal. Even still, so what...? Link to comment Share on other sites More sharing options...
Tlem Posted June 16, 2009 Author Share Posted June 16, 2009 (edited) I read well some posts about Valik and about his ego. But I find surprising the reactions on this forum which it wants a forum of help and of improvement of AutoIt. I understands whether it is their baby, but if the assistant brought by the members of the forum is systematically subject to pledge, then it is better than we let make these sirs. I have for my part enough work on the French forum by making what I can to help the members with my little knowledge. Thus once again, sorry to have disturbed you, I return in furtive mode. Edited June 16, 2009 by Tlem Best Regards.Thierry Link to comment Share on other sites More sharing options...
Valik Posted June 16, 2009 Share Posted June 16, 2009 I read well some posts about Valik and about his ego.Then you read posts written by idiots. I. Do. Not. Have. An. Ego.I really don't know how to make it any more clear than that. Far too many people make an assumption that just because I call somebody stupid or an idiot I am somehow asserting my superiority over everyone. Until the day I state "I am better than everybody" drop the ego bullshit. Stating somebody is stupid does not equate to stating I am better than somebody. 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