Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Fastest way to check memo field for a string
Message
 
 
À
07/07/2009 14:52:08
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01410639
Message ID:
01410668
Vues:
31
>>>I just tested this a few times and switched the order around. It appears you are correct. While the time changes depending on whether it is first, 2nd, 3rd, etc in the order (OCCURS() versus $ etc), $ does seem to be consistently the fastest.
>>
>>In Boris tests OCCURS() was the winner over $.
>
>:-)
>No way!
>
>? [$], SECONDS()-m1                   && 0.045
>? [OCCURS], SECONDS()-m1       && 0.284
>
>
>I even did this:
>
>CLEAR
>CREATE CURSOR crsTest (MyMemo M)
>APPEND BLANK
>REPLACE MyMemo WITH REPLICATE([A],16000000)+[ My String]
>DIMENSION atests[5]
>atests[1] = [aaa = AT("My String", MyMemo)]
>atests[2] = [aaa = RAT("My String", MyMemo)]
>atests[3] = [aaa = "My String" $ MyMemo]
>atests[4] = [aaa = OCCURS("My String", MyMemo)]
>atests[5] = [SELECT * FROM crsTest WHERE MyMemo LIKE "%My String%" INTO CURSOR aaa]
>RAND(-1)
>CREATE CURSOR Passed (Num I)
>INDEX ON Num TAG Passed
>SELECT crsTest
>DO WHILE .t.
>   lnRandom = INT(RAND()*10000000 % 5 + 1)
>   IF NOT SEEK(lnRandom,[Passed])
>      DoTest(lnRandom)
>      INSERT INTO Passed VALUES (lnRandom)
>      IF RECCOUNT([Passed]) > 4
>         EXIT
>      ENDIF
>   ENDIF
>ENDDO
>
>FUNCTION DoTest(lnNumber)
>    lcTest = atests[lnNumber]
>    m1  = SECONDS()
>    &lcTest
>    ? lcTest, SECONDS()-m1
>RETURN
>
>When I start it several times the [$] almost always has the same value 0.045-0.046, the rest vary from 0.045 to 0.980.

For this particular test in my system RAT is winning.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform