Hi Éric,
In order to find several words or expressions in a set of texts (each on one card) and to highlight each occurence of each of them, I had a handler (say, "hiliteWords") that worked well, but that I did not like much.
I got :
- one clever suggestion based on "dontSearch" from Jacqueline, modified (speeded up, see below) by Éric,
and another clever suggestion (with push and pop) from Jim.

I adapted them to my app. The two of them are very fast, without any noticeable difference. Times measures (thank you Éric for the script below) on 100 trials of each solution, returned the following means (in millisecs) : 611 for Jim and 604 for JacqÉric :-)) These results concerns a bigger process in which the "hiliteWords" handler is included.

So the choice remains "Cornéllian" !!
That's why, now, my app. is making random choices :-))) when it needs to hilite words found on a card, it chooses randomly between two handlers that I named "Jim", and "JacqÉric" :-)o)) And, of course, for each one, it is totalizing the number of times it was used and the time it took (In 4 fields of a substack).

This funny race started this afternoon !

Again, a lot of thanks to  Éric, Jacqueline and Jim,

Best regards from Grenoble
André



Le Monday, 6 Feb 2006, à 17:46 Europe/Paris, Eric Chatonet a écrit :

Bonjour André,

To make your decision, just do a test :-)
In a brand new stack:

on mouseUp
    local tStart, tNumOfCards = 2000, tNumOfTests = 10
    -----
    put "Creating" && tNumOfCards && "cards"
    lock screen
    repeat tNumOfCards
        new card
        set the dontSearch of this cd to random(100) > 50
    end repeat
    -----
  unlock screen
    put "Now testing"
    put the milliseconds into tStart
    repeat tNumOfTests
        repeat for each line tCd in the cardNames of this stack
            set the dontSearch of tCd to true
        end repeat
    end repeat
put (the milliseconds - tStart) div tNumOfTests && "milliseconds for" && tNumOfCards && "cards"
end mouseUp

I have just modified Jacque very clever idea by using a repeat for each form that usually is far faster than repeat with i = 1 to x. Actually my purpose was to show how it's easy and quick to write a little script to make one's decision: The test takes here about an average of 100 milliseconds for 2000 cards :-)

Le 6 févr. 06 à 13:55, André.Bisseret a écrit :

Jacqueline, I like your tricky "dontsearch" solution. I tried it ; currently I have 320 cards and it works well and is very fast. I am hesitating to use it because, at the end, after resetting the dontsearch of all cds to false, I must reset the dontsearch of certain cards to true ; well, anyway, the whole thing is running very fast ! Also, the number of cards in my app. is going to grow each years, so this solution could be provisional ; well, why not ! I have to make a decison, but, thanks to this list, it is really comfortable to can choose among several solutions !

Best Regards from Paris,
Eric Chatonet
----------------------------------------------------------------------- -----------------------
http://www.sosmartsoftware.com/    [EMAIL PROTECTED]/




_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to