in reply to Re^4: How Index function works??
in thread How Index function works??

It's not that index doesn't use Boyer Moore, it's more that the regex engine doesn't always use Boyer Moore. If the regex engine comes to the conclusion to use screaminstr, it will use that instead of Boyer Moore.

I guess that if you change your data to be more favorable to Boyer Moore, the results will reverse as the regular expression will still not use Boyer Moore.

Update: Even weirder. Looking at the log of use re 'Debug','ALL';, it claims that fbm_instr() is used:

C:\Projekte>perl -Mre=Debug,ALL -e "shift=~/abcdefghijklmnopqrstuvwxyz +X/" abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdef ghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzXabcdefghijklmnopqrstuvw +xyzabcdefghijklmnopqrstuvwxyz Compiling REx "abcdefghijklmnopqrstuvwxyzX" Starting first pass (sizing) >abcdefghij... | 1| reg | | brnc | | piec | | atom Required size 9 nodes Starting second pass (creation) >abcdefghij... | 1| reg | | brnc | | piec | | atom >< | 10| tail~ EXACT <abcdefghijklmnopqrstuvwxyzX> (1 +) -> END first:> 1: EXACT <abcdefghijklmnopqrstuvwxyzX> (9) first at 1 Peep:Pos:0/0 Flags: 0x0 Whilem_c: 0 Lcp: 0 Last:'' 0:0/0 *Fixed:'' @ 0 + Float: '' @ 0/0 Peep> 1: EXACT <abcdefghijklmnopqrstuvwxyzX> (9) join> 1: EXACT <abcdefghijklmnopqrstuvwxyzX> (9) pre-fin:Pos:27/0 Flags: 0x0 Whilem_c: 0 Lcp: 0 Last:'abcdefghijklmnopq +rstuvwxyzX' 27:0/0 *Fixed:'' @ 0 Float: '' @ 0/0 post-fin:Pos:27/0 Flags: 0x0 Whilem_c: 0 Lcp: 0 Last:'abcdefghijklmnop +qrstuvwxyzX' 27:0/0 *Fixed:'' @ 0 Float: '' @ 0/0 commit: Pos:27/0 Flags: 0x0 Whilem_c: 0 Lcp: 0 Last:'abcdefghijklmnopq +rstuvwxyzX' -1:0/0 *Fixed:'abcdefghijklmnopqrstuvwxyzX' @ 0 Fl oat: '' @ 0/0 minlen: 27 r->minlen:0 Final program: 1: EXACT <abcdefghijklmnopqrstuvwxyzX> (9) 9: END (0) anchored "abcdefghijklmnopqrstuvwxyzX" at 0 (checking anchored isall) +minlen 27 r->extflags: CHECK_ALL USE_INTUIT_NOML USE_INTUIT_ML Guessing start of match in sv for REx "abcdefghijklmnopqrstuvwxyzX" ag +ainst "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabc defgh"... Check offset min: 0 Start shift: 0 End shift 0 Real End Shift: 0 fbm_instr len=157 str=<abcdefghijklmnopqrst> Found anchored substr "abcdefghijklmnopqrstuvwxyzX" at offset 78... Check offset min:0 max:0 S:78 t:78 D:0 end:157 Starting position does not contradict /^/m... Guessed: match at offset 78 Freeing REx: "abcdefghijklmnopqrstuvwxyzX"

So, I don't understand what happens, or how the RE engine is faster than index when they both fire up fbm_instr.

Replies are listed 'Best First'.
Re^6: How Index function works??
by LanX (Saint) on Oct 24, 2011 at 10:13 UTC
    I can't follow... could you plz show me what you think is a fair test?

    Cheers Rolf