From c5bdb89b5b33e46c9bcf54aadff5584a58580e9b Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Thu, 16 Aug 2018 21:02:29 +0200 Subject: [PATCH] BusTerm_test: obvious performance improvement on RegExp search MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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≻ --- tests/gui/bus-term-test.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/gui/bus-term-test.cpp b/tests/gui/bus-term-test.cpp index ed15d4f82..4877daa98 100644 --- a/tests/gui/bus-term-test.cpp +++ b/tests/gui/bus-term-test.cpp @@ -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())) );