 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
wOxxOm
Joined: 09 Feb 2006 Posts: 319
|
Posted: Thu Mar 09, 2006 12:57 pm Post subject: Now rewriting parsing engine to use inStr. RESULTS are WOW!! |
|
|
Wow!!! it is awesome. read comments in code. it's a piece-o'cake!
20000 files in runList. Search is done for milliseconds!!!! 100'000x speed-up in case of unique files search! Check it & believe it.
| Code: |
;.........ripped........
ItemList=%RecentList%%ItemList%
ItemListU:=strUpper(ItemList) ; LOCALE specific dllWrapper
;.........ripped........
LastText=%CurrText%
CurrTextU:=strUpper(CurrText) ; LOCALE specific dllWrapper
;.........ripped........
IfNotEqual, CurrText,
{
;.........ripped........
iL:=inStr(ItemListU,currTextU,1) ; lightning-fast check if there is occurence
iU:=strPos(usedList,currText) ; strPos=inStr(strUpper(where),strUpper(what),CaseON)
SearchList=
ifNotEqual,iU,0,SearchList:=UsedList ; usedList is always very small (<100 items by design) so no need to rip it
if (iL) ; clip itemList from first to last occurence of currText to enormously reduce work in loop,parse,searchList
{ i:=inStr(strLeft(itemList,iL),"|",1,0) ; backwards find start of fileName
j:=inStr(itemListU,currTextU,1,0) ; backwards find last occurence of CurrText in uppercase, see above the assignments
j:=inStr(itemListU,"|",1,j+1) ; forward search the end of fileName last seen in itemList
SearchList:=SearchList . strMid(itemList,i+1,j-i-1) ; strMid is simple wrapper for stringMid
}
if (SearchList) ; now search list is reduced from few percent (beginning of typing) to 1000x (!!!!!!!!!!!!!) times when you type at least some unique part of your file
{ ;___________________________________________
; Advanced Search
;.........ripped........
}
else ; itemList & usedList do not contain currText (strPos check) so after 0.1 ms (!) of inStr comparing we know there is nothing to fight for
GuiControl,,Results,Nothing found!
;.........ripped........
|
P.S. now I will rewrite main parse to use only inStr without "loop,parse" at all |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10480
|
Posted: Thu Mar 09, 2006 2:15 pm Post subject: |
|
|
Would it be suitable to put this in some other topic such as Deferred icon loading implementation? I ask because the Scripts forum is more accessible (easier to navigate) when the number of topics is kept to a minimum.
Thanks. |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Thu Mar 09, 2006 2:18 pm Post subject: |
|
|
The problem is that in both topics, I have strictly no idea of what these code fragments (neither scripts nor functions) really do. What is the context, what is their use, etc.
wOxxOm seems to continue a topic from elsewhere or a conversation with himself... _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2") |
|
| Back to top |
|
 |
wOxxOm
Joined: 09 Feb 2006 Posts: 319
|
Posted: Thu Mar 09, 2006 2:22 pm Post subject: |
|
|
| PhiLho wrote: | The problem is that in both topics, I have strictly no idea of what these code fragments (neither scripts nor functions) really do. What is the context, what is their use, etc.
wOxxOm seems to continue a topic from elsewhere or a conversation with himself... |
Ok. I thought it would be nice to have essentially accelerated code right here. I will post a new topic. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|