diff options
author | ToineSiebelink <toine.siebelink@est.tech> | 2022-12-20 11:32:26 +0000 |
---|---|---|
committer | ToineSiebelink <toine.siebelink@est.tech> | 2022-12-20 13:53:33 +0000 |
commit | 92d9116dfff9898279adcaef529301136f5e8177 (patch) | |
tree | efd73df6b07b572988476a2156d0efb6da727037 | |
parent | e52d0cbf970f1de982fb64f1a052646457b81f52 (diff) |
Check preformance impacts
-Added a basic perf. test to process 200K CPS paths using parser
Issue-ID: CPS-1409
Signed-off-by: ToineSiebelink <toine.siebelink@est.tech>
Change-Id: Ibf8aed53506d28ba08f7166a44bd6fe9aefa5952
-rw-r--r-- | cps-path-parser/src/test/groovy/org/onap/cps/cpspath/parser/CpsPathUtilSpec.groovy | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/cps-path-parser/src/test/groovy/org/onap/cps/cpspath/parser/CpsPathUtilSpec.groovy b/cps-path-parser/src/test/groovy/org/onap/cps/cpspath/parser/CpsPathUtilSpec.groovy index 31c1ed4a3a..662e42b6b2 100644 --- a/cps-path-parser/src/test/groovy/org/onap/cps/cpspath/parser/CpsPathUtilSpec.groovy +++ b/cps-path-parser/src/test/groovy/org/onap/cps/cpspath/parser/CpsPathUtilSpec.groovy @@ -20,6 +20,7 @@ package org.onap.cps.cpspath.parser +import org.springframework.util.StopWatch import spock.lang.Specification class CpsPathUtilSpec extends Specification { @@ -71,4 +72,17 @@ class CpsPathUtilSpec extends Specification { thrown(PathParsingException) } + def 'CPS Path Processing Performance Test.'() { + when: '200,000 paths are processed' + def setupStopWatch = new StopWatch() + setupStopWatch.start() + (1..100000).each { + CpsPathUtil.getNormalizedXpath('/long/path/to/see/if/it/adds/paring/time/significantly/parent/child[@common-leaf-name="123"]') + CpsPathUtil.getNormalizedXpath('//child[@other-leaf=1]/leaf-name[text()="search"]/ancestor::parent') + } + setupStopWatch.stop() + then: 'it takes less then 10,000 milliseconds' + // In CI this actually takes about 3-5 sec which is approx. 50+ parser executions per millisecond! + assert setupStopWatch.getTotalTimeMillis() < 10000 + } } |