BusTerm_test: obvious performance improvement on RegExp search

Greedy wildcard match .+ is unnecessary, since in case of a positive match,
the next given expression always follows immediately. We just want to skip
over some "syntactic noise"

This change makes the matching time linear in the size of the log.

But unfortunately, I still occasionally see an Segmentation Fault.
It seems to arise when compiling the regular expresions

e.g. the following RegExps cashed (right in the middle of the test)

after.+?_ATTRIBS_.+?ins.+?53 of 57 ≺358.gen010≻.+?mut.+?53 of 57 ≺358.gen010≻.+?ins.+?borgID.+?358.+?emu.+?53 of 57 ≺358.gen010≻
after.+?_ATTRIBS_.+?ins.+?53 of 63 ≺178.gen028≻.+?mut.+?53 of 63 ≺178.gen028≻.+?ins.+?borgID.+?178.+?emu.+?53 of 63 ≺178.gen028≻
after.+?_ATTRIBS_.+?ins.+?53 of 59 ≺498.gen038≻.+?mut.+?53 of 59 ≺498.gen038≻.+?ins.+?borgID.+?498.+?emu.+?53 of 59 ≺498.gen038≻
after.+?_ATTRIBS_.+?ins.+?53 of 60 ≺223.gen003≻.+?mut.+?53 of 60 ≺223.gen003≻.+?ins.+?borgID.+?223.+?emu.+?53 of 60 ≺223.gen003≻
after.+?_ATTRIBS_.+?ins.+?53 of 78 ≺121.gen015≻.+?mut.+?53 of 78 ≺121.gen015≻.+?ins.+?borgID.+?121.+?emu.+?53 of 78 ≺121.gen015≻
This commit is contained in:
Fischlurch 2018-08-16 21:02:29 +02:00
parent 3a100972d7
commit c5bdb89b5b

View file

@ -749,11 +749,11 @@ namespace test {
CHECK (nexusLog.verifyCall("routeAdd").arg(rootMock.getID(), memLocation(rootMock)) // rootMock was attached to Nexus
.beforeCall("change") .argMatch(rootMock.getID(), // diff message sent via UI-Bus
"after.+_ATTRIBS_.+" // verify diff pattern generated for each Borg
"ins.+"+childID+".+"
"mut.+"+childID+".+"
"ins.+borgID.+"+borgID+".+"
"emu.+"+childID)
"after.+?_ATTRIBS_.+?" // verify diff pattern generated for each Borg
"ins.+?"+childID+".+?"
"mut.+?"+childID+".+?"
"ins.+?borgID.+?"+borgID+".+?"
"emu.+?"+childID)
.beforeCall("routeAdd").arg(borg.getID(), memLocation(borg)) // Borg was inserted as child and attached to Nexus
.beforeEvent("applied diff to "+string(rootMock.getID()))
);