regex can degrade performance of subsequent statements

If you find an issue in LiveCode but are having difficulty pinning down a reliable recipe or want to sanity-check your findings with others, this is the place.

Please have one thread per issue, and try to summarize the issue concisely in the thread title so others can find related issues here.

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

rkriesel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 57
Joined: Thu Apr 13, 2006 6:25 pm

regex can degrade performance of subsequent statements

Post by rkriesel » Sun Dec 11, 2016 6:35 am

Paste the following code into a new stack to demonstrate that evaluating a particular regular expression can degrade the performance of multiple subsequent statements.

Code: Select all

-- goal of this stack: demonstrate that evaluating a particular regular expression can degrade the performance of multiple subsequent statements
 
-- expected result: the sequence of independent timing tests has little effect on the timings
-- observed result: after one particular regex, four other functions take two to thirty times as long to execute

-- for a demonstration, execute command test1; at the breakpoint, see variables tMillisecondsByCycleAcrossTest and tRatiosByCycleAcrossTest
-- for the regex, see function tdz1
-- notice that after function tdz1 runs for the first time:
--   function cd1 takes about thirty times as long (it has a repeat-for-each-line)
--   function hh3 takes about three times as long (it has a repeat-for-each-line with a nested repeat-for-each-line)
--   function tdz2 takes over twice as long (it has a regex evaluation)
--   function dk2 takes over five times as long (it has a repeat-for-each-line with a nested repeat-for-each-line that does nothing!)
-- for an unaffected function, see dk1 (it has a repeat-for-each-line with a nested repeat-for-each-key)

-- for the concepts and rules of the game behind the code, see "SET" at http://smart-games.org/
-- for the forum discussion that lead to the evidence, see http://forums.livecode.com/viewtopic.php?f=7&t=28288
-- author: rkriesel, with thanks to dunbarx, tdz, and -hh for their functions, and to capellan for the data

-- base case, excluding test tdz1:
milliseconds by cycle across test
8.1.1 14008 MacOS 10.12.1
cycle	cd1	hh3	tdz2	dk1	dk2
1	1.9	7.7	1.8	0.7	3.6
2	2	7.8	1.9	0.8	3.5
3	1.9	7.8	2	0.7	3.5
4	1.9	7.7	2	0.7	3.4
5	1.9	7.6	1.8	0.7	3.4

-- cycles vary by only about 10 percent:
ratios by cycle across test
8.1.1 14008 MacOS 10.12.1
cycle	cd1	hh3	tdz2	dk1	dk2
1	1	1	1	1	1
2	1	1	1.1	1	1
3	1	1	1.1	1	1
4	1	1	1.1	1	1
5	1	1	1	1	0.9

-- comparison case, including test tdz1:
milliseconds by cycle across test
8.1.1 14008 MacOS 10.12.1
cycle	cd1	hh3	tdz2	dk1	dk2	tdz1
1	1.8	7.7	1.9	0.7	3.4	0.9
2	63	23.4	4.6	0.8	18.4	0.9
3	65.2	23.8	4.7	0.8	18.8	0.9
4	63.6	23.8	4.6	0.8	18.6	0.9
5	63	23.8	4.7	0.8	18.5	0.9

-- after the first execution of tdz1, four tests take very much longer:
ratios by cycle across test
8.1.1 14008 MacOS 10.12.1
cycle	cd1	hh3	tdz2	dk1	dk2	tdz1
1	1	1	1	1	1	1
2	34.2	3.1	2.5	1.1	5.3	1
3	35.3	3.1	2.5	1.1	5.4	1
4	34.5	3.1	2.5	1	5.4	1
5	34.1	3.1	2.5	1.1	5.4	1

-- ratios in LC 9
ratios by cycle across test
9.0.0-dp-3 15002 MacOS 10.12.1
cycle	cd1	hh3	tdz2	dk1	dk2	tdz1
1	1	1	1	1	1	1
2	31.3	2.9	2	1	5.3	0.9
3	31.5	2.9	2.1	1.1	5.5	1
4	32.1	3	2	1.1	5.3	1
5	32.9	3	2	1.1	5.3	0.9

-- ratios in LC 7
ratios by cycle across test
7.1.4 10057 MacOS 10.12.1
cycle	cd1	hh3	tdz2	dk1	dk2	tdz1
1	1	1	1	1	1	1
2	28	2.8	2	1	4.9	1
3	27.3	2.8	2	1	5	1
4	27.9	2.8	2	1	5	1
5	27.7	2.8	2	1	5	1

----------------------------------------------------------------------------------------------------

local sSets
local sCards
local sSetsForCard -- sSetsForCard[ tCard ][ tSet ] = "true" -- which sets contain a given card?

command test1
    local tTests = "cd1,hh3,tdz2,dk1,dk2,tdz1"
    local tCycleCount = 5
    local tMilliseconds
    local tMillisecondsForTestAndCycle -- tMillisecondsForTestAndCycle[<test>][<cycle>] = <milliseconds>
    local tMillisecondsByCycleAcrossTest = "milliseconds by cycle across test" -- cross-tab report with a row for each cycle and a column for each test
    local tRatiosByCycleAcrossTest = "ratios by cycle across test" -- cross-tab report with a row for each cycle and a column for each test
    init1
    get cr & version() && buildNumber() && platform() && systemVersion() & cr & "cycle" & tab & replaceText( tTests, comma, tab ) & cr
    put it after tMillisecondsByCycleAcrossTest
    put it after tRatiosByCycleAcrossTest
    repeat with tCycle = 1 to tCycleCount
        put tCycle & tab after tMillisecondsByCycleAcrossTest
        put tCycle & tab after tRatiosByCycleAcrossTest
        repeat for each item tTest in tTests
            put 0 - the long milliseconds into tMilliseconds
            dispatch function tTest with sCards, sSets
            add the long milliseconds to tMilliseconds
            put tMilliseconds into tMillisecondsForTestAndCycle[ tTest ][ tCycle ]
            put round( tMilliseconds, 1 ) & tab after tMillisecondsByCycleAcrossTest
            put round( tMilliseconds / tMillisecondsForTestAndCycle[ tTest ][ 1 ], 1 ) & tab after tRatiosByCycleAcrossTest
        end repeat
        put cr into last char of tMillisecondsByCycleAcrossTest
        put cr into last char of tRatiosByCycleAcrossTest
    end repeat
    
    breakpoint
end test1

private command init1
    --if sSetsForCard is not an array then
        get the script of me
        put line -1080 to -1 of it into sSets
        put line -1093 to -1082 of it into sCards
        initializeSetsForCard sSets
    --end if
end init1

on openStack
    show me
    set the destroyStack of me to "true"
    set the destroyWindow of me to "true"
end openStack

--> cd

function cd1 WL, SC
    local tCombinations
    repeat for each line Q in SC
        if lineoffset(word 1 of Q,WL) <> 0 and \
              lineoffset(word 2 of Q,WL) <> 0 and \
              lineoffset(word 3 of Q,WL) <> 0
        then
            put Q & return after tCombinations
        end if
    end repeat
    return tCombinations
end cd1

--> dk

function dk1 pShownCards
    return getSetsForShownCards( pShownCards )
end dk1

function getSetsForShownCards pShownCards -- pShownCards is a return-delimited list; so is the result
    local tCountForSet -- tCountForSet[ tSet ] = tCount -- how many shown cards for a given set
    local tShownSets -- tShownSets[ tSet ] = "true" -- sets that contain three of the shown cards
    
    repeat for each line tCard in pShownCards -- for each shown card
        repeat for each key tSet in sSetsForCard[ tCard ] -- for each set that contains the card
            add 1 to tCountForSet [ tSet ] -- increment the set’s count of shown cards
            if tCountForSet [ tSet ] is 3 then -- if the set has three shown cards then
                put "true" into tShownSets[ tSet ] -- remember it
            end if
        end repeat
    end repeat
    
    return the keys of tShownSets
end getSetsForShownCards

private command initializeSetsForCard pSets -- pSets is a return-delimited list of sets; each set is a space-delimited list of cards
    repeat for each line tSet in pSets
        put "true" into sSetsForCard[ word 1 of tSet ][ tSet ]
        put "true" into sSetsForCard[ word 2 of tSet ][ tSet ]
        put "true" into sSetsForCard[ word 3 of tSet ][ tSet ]
    end repeat
end initializeSetsForCard

function dk2 pShownCards, pSets
    repeat for each line tSet in pSets
        repeat for each line tCard in pShownCards
            -- do nothing!
        end repeat
    end repeat
    return empty
end dk2

--> hh

function hh3 zxs, SC1080
    local check, fOUT
    repeat for each line K in SC1080
        repeat for each line L in zxs
            if L is in K then add 1 to check[K]
        end repeat
        if check[K] = 3 then put cr & K after fOUT
    end repeat
    delete char 1 of fOUT
    return fOUT
end hh3

--> tdz

function tdz1 random12, text1080
    local R
    filter lines of text1080 with regex \
          pattern format("^(?:(?:%s)\\s){3}",replaceText(random12,return,"|")) \
          into R
    return R
end tdz1

function tdz2 random12, text1080
    local REX, gotIT, R
    replace return with "|" in random12
    put "^((?:(?:" & random12 &  ")\s){3})" into REX
    repeat for each line K in text1080
        if matchText(K,REX,gotIT) then \
              put char 1 to -2 of gotIT &cr after R
    end repeat
    delete last char of R
    return R
end tdz2

--> data: sCards
1GHO
2GFD
2GFO
2PLS
2RHD
2RHO
2RHS
3GLO
3PFS
3PHD
3PHS
3PLD
--> data: sSets
1GFD 1GFO 1GFS
1GFD 1GHD 1GLD
1GFD 1GHO 1GLS
1GFD 1GHS 1GLO
1GFD 1PFD 1RFD
1GFD 1PFO 1RFS
1GFD 1PFS 1RFO
1GFD 1PHD 1RLD
1GFD 1PHO 1RLS
1GFD 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3PHO 3RFS
3GLD 3PHS 3RFO
3GLD 3PLD 3RLD
3GLD 3PLO 3RLS
3GLD 3PLS 3RLO
3GLO 3PFD 3RHS
3GLO 3PFO 3RHO
3GLO 3PFS 3RHD
3GLO 3PHD 3RFS
3GLO 3PHO 3RFO
3GLO 3PHS 3RFD
3GLO 3PLD 3RLS
3GLO 3PLO 3RLO
3GLO 3PLS 3RLD
3GLS 3PFD 3RHO
3GLS 3PFO 3RHD
3GLS 3PFS 3RHS
3GLS 3PHD 3RFO
3GLS 3PHO 3RFD
3GLS 3PHS 3RFS
3GLS 3PLD 3RLO
3GLS 3PLO 3RLD
3GLS 3PLS 3RLS
3PFD 3PFO 3PFS
3PFD 3PHD 3PLD
3PFD 3PHO 3PLS
3PFD 3PHS 3PLO
3PFO 3PHD 3PLS
3PFO 3PHO 3PLO
3PFO 3PHS 3PLD
3PFS 3PHD 3PLO
3PFS 3PHO 3PLD
3PFS 3PHS 3PLS
3PHD 3PHO 3PHS
3PLD 3PLO 3PLS
3RFD 3RFO 3RFS
3RFD 3RHD 3RLD
3RFD 3RHO 3RLS
3RFD 3RHS 3RLO
3RFO 3RHD 3RLS
3RFO 3RHO 3RLO
3RFO 3RHS 3RLD
3RFS 3RHD 3RLO
3RFS 3RHO 3RLD
3RFS 3RHS 3RLS
3RHD 3RHO 3RHS
3RLD 3RLO 3RLS
The code is in the above code box because the forum software prevents uploading an attachment with type livecodescript.

If anyone would confirm the above and/or offer suggestions about making a better bug report, I'd appreciate it.

-- Dick

rkriesel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 57
Joined: Thu Apr 13, 2006 6:25 pm

Re: regex can degrade performance of subsequent statements

Post by rkriesel » Sun Dec 11, 2016 11:11 am

rkriesel wrote:...the forum software prevents uploading an attachment with type livecodescript.
But zipping it works. @Thierry: thanks
test regex side effect.livecodescript.zip
(7.08 KiB) Downloaded 49 times
-- Dick

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1553
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: regex can degrade performance of subsequent statements

Post by [-hh] » Sun Dec 11, 2016 4:28 pm

Your test script will be very hard to improve. Great work!

As I never ever in my life used breakpoints or the script debug mode I add below a test stack (see attachment) which shows the tables your script creates. Please check if the few lines changed (for output) at the beginning and at the end of handler "test1" are not to your intentions.

As a first confirmation you'll find my results for LC 6/7 and LC 7/8 below. They show at about the same results as yours.

Included in the test is the following function 'hh4' which is my latest in the pattern-matching-thread (you overlooked this function):

Code: Select all

function hh4 zxs -- the random sample, nothing else needed
   local fOut
   repeat with i=1 to 12
      put line i of zxs into l1
      put char 1 of l1 into u1; put char 2 of l1 into u2
      put char 3 of l1 into u3; put char 4 of l1 into u4
      repeat with j=i+1 to 12
         put line j of zxs into l2
         put char 1 of l2 into v1; put char 2 of l2 into v2
         put char 3 of l2 into v3; put char 4 of l2 into v4
         repeat with k=j+1 to 12
            put line k of zxs into l3
            -- checking for the rules of the game SET
            if u1 & v1 &char 1 of l3 is not in "111,222,333,123,132,213,312,231,321" then next repeat
            if u2 & v2 &char 2 of l3 is not in "RRR,GGG,PPP,RGP,RPG,GRP,PRG,GPR,PGR" then next repeat
            if u3 & v3 &char 3 of l3 is not in "FFF,LLL,HHH,FLH,FHL,LFH,HFL,LHF,HLF" then next repeat
            if u4 & v4 &char 4 of l3 is not in "DDD,OOO,SSS,DOS,DSO,ODS,SDO,OSD,SOD" then next repeat
            put cr & l1 &space& l2 &space& l3 after fOut
         end repeat
      end repeat
   end repeat
   return char 2 to -1 of fOut
end hh4
This is possibly a memory bug, introduced in LC 7. Perhaps your detective work could also contribute to find the culprit for the huge amount (in some cases) of the general slowdown of LC 7/8/9 compared to LC 6.
 
Attachments
regexsideEffects.livecode.zip
Dick's test as stack
(9.96 KiB) Downloaded 39 times
regexTestLC6and7.png
Results for LC 6.7.11 and LC 7.1.4. Click to enlarge.
regexTestLC8and9.png
Results for LC 8.1.1 and LC 9.0.0. Click to enlarge.
shiftLock happens

rkriesel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 57
Joined: Thu Apr 13, 2006 6:25 pm

Re: regex can degrade performance of subsequent statements

Post by rkriesel » Mon Dec 12, 2016 5:44 am

[-hh] wrote:Your test script will be very hard to improve. Great work!
Danke sehr, Hermann.

Here's a refactored version that still supports your UI. There's a kludge for LC6, in which function tdz1 does no harm, but no good either, as it returns empty.
regexSideEffects r1.livecode.zip
(9.72 KiB) Downloaded 47 times
So we're improving the eventual bug report. Maybe we'll get more ideas from Thierry and others too.
[-hh] wrote:Perhaps your detective work could also contribute to find the culprit for the huge amount (in some cases) of the general slowdown of LC 7/8/9 compared to LC 6.
If that's due to a bug, there ought to be a bounty for it. Is there a repository of evidence available to support detective work?

-- Dick

Thierry
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 580
Joined: Wed Nov 22, 2006 3:42 pm
Location: France
Contact:

Re: regex can degrade performance of subsequent statements

Post by Thierry » Mon Dec 12, 2016 9:57 am

Hi,

Dirk, I'm afraid that the title of this thread is a bit misleading :(

Looking closely at the 2 functions tdz1() and tdz2(),
it's easy to see that both functions are using the same regex!

So the regex is not the culprit here.

Otherwise, I think you have opened an interesting door for a bug report
but not about the regex.
I'll try to be back later as I have some ideas to narrow down the problem
but not much free time right now.

Here is my today's morning quick and dirty test with LC 8 (only) and same regex:
sunnY 2016-12-12 à 09.37.37.png

As you can see, timings are consistent.

Kind regards,

Thierry

PS: no idea about LC6 as it's not part of my tools anymore
Thierry Douez - https://sunny-tdz.com
Pourquoi tant de notes lorsqu'il suffit de jouer les plus belles... [Barbara]

LCMark
Livecode Staff Member
Livecode Staff Member
Posts: 949
Joined: Thu Apr 11, 2013 11:27 am

Re: regex can degrade performance of subsequent statements

Post by LCMark » Mon Dec 12, 2016 10:57 am

I think I can explain what is happening here (although I couldn't confirm as I couldn't get the stack to run :().

The PCRE library can either be compiled for 16-bit 'code units' or 8-bit 'code units'. As the engine now supports unicode, we use the 16-bit compiled version. This means that a string which is passed through replaceText or matchText must be converted to UTF-16 before being processed by PCRE. Once this is done once, the engine does not convert back - although it does mark the string as being able to be represented with 8-bit code-units.

So, the issue here (I suspect) is that once a string has been used in replaceText/matchText/regex then it will be UTF-16 internally, the processing for which is slower than that for native chars. One way to verify this is to make sure the string which is passed to replaceText/matchText is a modified copy. e.g. Rather than:

Code: Select all

get matchText(pattern, string)
Do

Code: Select all

put string & "a" into string2
delete the last char of string2
get matchText(pattern, string2)
The generation of 'string2' here ensures that string2 does not point to the same internal string as string, and thus the original string is unaffected by the operation.

Thierry
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 580
Joined: Wed Nov 22, 2006 3:42 pm
Location: France
Contact:

Re: regex can degrade performance of subsequent statements

Post by Thierry » Tue Dec 13, 2016 8:23 am

Hi,

@Mark:
Interesting explanation which i'll try to remember for further projects
but it doesn't explain why in my previous Post, I get back a normal
behavior without changing the tdz1 function (the one using the regex)

@Dirk:
after line 250 of your stack script, drop everything till the end of the script.
You should have a normal behavior back again.

My 2 cents,

Kind regards,

Thierry
Thierry Douez - https://sunny-tdz.com
Pourquoi tant de notes lorsqu'il suffit de jouer les plus belles... [Barbara]

rkriesel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 57
Joined: Thu Apr 13, 2006 6:25 pm

Re: regex can degrade performance of subsequent statements

Post by rkriesel » Tue Dec 13, 2016 10:57 am

@LCMark: Your suggestion successfully prevents the degradation.
regexSideEffects r2.png
Thanks for the suggestion. Where does that knowledge belong in the documentation? Do you want a bug report?
Does the slow down from LC6 warrant further investigation?
LCMark wrote:I couldn't get the stack to run
That's not much for a bug report. :D

Here's a revision that incorporates your suggestion, and that produced the pictured results above.
regexSideEffects r2.livecode.zip
(10.67 KiB) Downloaded 38 times
-- Dick


LCMark
Livecode Staff Member
Livecode Staff Member
Posts: 949
Joined: Thu Apr 11, 2013 11:27 am

Re: regex can degrade performance of subsequent statements

Post by LCMark » Tue Dec 13, 2016 7:15 pm

@rkriesel: Hehe - yes - it wasn't intended to be a bug report, more just saying I hadn't tried it myself ;)

@russellf: Yes - that is almost certainly the same bug. We will have to consider how to mitigate this - whilst transforming between single-byte and double-byte reps isn't all that slow, it is proportional to the length of the string (obviously) so there is a speed impact in doing it which gets harder to swallow as the amount of text gets larger. It might be we end up compiling an 8-bit version of PCRE alongside the 16-bit version which, whilst a code cost, would mean that we can get matchText running on non-unicode strings at the same speed as before.

rkriesel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 57
Joined: Thu Apr 13, 2006 6:25 pm

Re: regex can degrade performance of subsequent statements

Post by rkriesel » Wed Dec 14, 2016 2:37 am

Thierry wrote:I'm afraid that the title of this thread is a bit misleading :(

Looking closely at the 2 functions tdz1() and tdz2(),
it's easy to see that both functions are using the same regex!

So the regex is not the culprit here.
I agree about the culprit here. However, "using regex in LiveCode can degrade ..." seems unnecessarily wordy for a subject line in this forum. What do you think would have been a good, less misleading, subject line?

"... easy to see ..."? Not for this regex novice. To me the two functions look different enough, even though they produce the same result, to be different in both performance and side effect, due to some quirk in the interface between LiveCode and PCRE.

-- Dick

LCMark
Livecode Staff Member
Livecode Staff Member
Posts: 949
Joined: Thu Apr 11, 2013 11:27 am

Re: regex can degrade performance of subsequent statements

Post by LCMark » Wed Dec 14, 2016 11:15 am

@tdz: The difference between tdz1 and tdz2 is just that tdz2 is doing a lot more work than tdz1.

In tdz1, 'filter lines of with regex' is used. This means that the regex is only run on substrings of text1080, thus text1080 is never wholly converted to utf-16 internally - critically, only substrings are converted to utf-16 internally temporarily.

In contrast, tdz2 is chunking text1080 (line by line) which creates a substring, and then that substring is converted to utf-16, and then the resulting string is accumulating.

Whilst the functionality is (largely) identical, filter lines of with regex is implemented in the engine, and thus will be faster than a comparable script version.

Thierry
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 580
Joined: Wed Nov 22, 2006 3:42 pm
Location: France
Contact:

Re: regex can degrade performance of subsequent statements

Post by Thierry » Wed Dec 14, 2016 11:44 am

LCMark wrote: In tdz1, 'filter lines of with regex' is used. This means that the regex is only run on substrings of text1080, thus text1080 is never wholly converted to utf-16 internally - critically, only substrings are converted to utf-16 internally temporarily.

In contrast, tdz2 is chunking text1080 (line by line) which creates a substring, and then that substring is converted to utf-16, and then the resulting string is accumulating.
Thanks Mark for this explanation!


Please, please please, could you explain then why this works (one of my previous post):
after line 250 of your stack script, drop everything till the end of the script.
You should have a normal behavior back again without changing anything in tdz1
I don't see the relationship with your previous explanations...
Thierry Douez - https://sunny-tdz.com
Pourquoi tant de notes lorsqu'il suffit de jouer les plus belles... [Barbara]

LCMark
Livecode Staff Member
Livecode Staff Member
Posts: 949
Joined: Thu Apr 11, 2013 11:27 am

Re: regex can degrade performance of subsequent statements

Post by LCMark » Wed Dec 14, 2016 11:52 am

@Thierry: I'm not sure I'm clear on what doing that affects. Could it just be deleting some of the script causes it to recompile / reset one of the script locals so things are rebuilt and thus are not in UTF-16 internally anymore?

Thierry
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 580
Joined: Wed Nov 22, 2006 3:42 pm
Location: France
Contact:

Re: regex can degrade performance of subsequent statements

Post by Thierry » Wed Dec 14, 2016 12:21 pm

LCMark wrote:@Thierry: I'm not sure I'm clear on what doing that affects. Could it just be deleting some of the script causes it to recompile / reset one of the script locals so things are rebuilt and thus are not in UTF-16 internally anymore?
Thanks, so pleased to get an answer.

The deleted lines are not valid scripts at all; only a copy of some Datas
that Dirk copy there for whatever reasons.

As dropping those lines makes the tdz1 function work as expected,
I feel strongly this should be considered as a bug.
Thierry Douez - https://sunny-tdz.com
Pourquoi tant de notes lorsqu'il suffit de jouer les plus belles... [Barbara]

Post Reply

Return to “Bug Triage”