Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread Speed problem with BuildWordList
Thu, Sep 6 2007 10:15 AMPermanent Link

Igor Colovic
Procedure TDataEngine.BuildWordList is slow because it is searching WordList twice, witch
is bad.

I have changed code

        TextIndexTokenFilter(TableName,FieldName,StrPas(@CurWord),Include);
        if Include then
           begin

//            if WordList.Find(StrPas(@CurWord),CurWordPos) then <-- Here WordList is
searched for CurWord and is returning CurWordPos
//               WordList.Objects[CurWordPos]:=
//                    
TObject(MinimumInteger(High(Word),(Integer(WordList.Objects[CurWordPos])+1)))
//            else
//               WordList.AddObject(StrPas(@CurWord),TObject(1)); <-- Here WordList is
again searched (by AddObject if list is sorted)

                CurWordPos := WordList.AddObject(StrPas(@CurWord),TObject(0)); *
                WordList.Objects[CurWordPos]:=
TObject(MinimumInteger(High(Word),(Integer(WordList.Objects[CurWordPos])+1))) **

* We are trying to add new word (with number of occurences 0). Because WordList is set to
be Ignore duplicates AddObject will:
1. If word exist just return CurWordPos
2. If word dose not exists Insert word and return CurWordPos

** Here we add number of occurrecens
Fri, Sep 7 2007 6:05 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Igor,

<< Procedure TDataEngine.BuildWordList is slow because it is searching
WordList twice, witch is bad. >>

I'll see about improving this for the next build.

--
Tim Young
Elevate Software
www.elevatesoft.com

Image