AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Now rewriting parsing engine to use inStr. RESULTS are WOW!!

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
wOxxOm



Joined: 09 Feb 2006
Posts: 319

PostPosted: Thu Mar 09, 2006 12:57 pm    Post subject: Now rewriting parsing engine to use inStr. RESULTS are WOW!! Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10480

PostPosted: Thu Mar 09, 2006 2:15 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
PhiLho



Joined: 27 Dec 2005
Posts: 6721
Location: France (near Paris)

PostPosted: Thu Mar 09, 2006 2:18 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
wOxxOm



Joined: 09 Feb 2006
Posts: 319

PostPosted: Thu Mar 09, 2006 2:22 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group