You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix quadratic performance of tag/step/exception scenario filtering (#411)
Rendering the "scenarios by tag/step/exception" pages cloned all
reports and linearly re-scanned every element for each unique
tag/step/exception, making generation effectively O(n^2) in the
number of scenarios. Replace the per-page full re-scan with a
report/element grouping computed once, and build each filtered
page directly from only the matching reports instead of cloning
and filtering the full report list every time.
On a 7619-scenario report this reduces generation time from ~242s
to ~36s (6.7x), with no change in generated output (verified via
full test suite and byte-for-byte diff of generated reports).
Copy file name to clipboardExpand all lines: engine/src/main/java/com/trivago/cluecumber/engine/rendering/pages/pojos/pagecollections/AllScenariosPageCollection.java
+131Lines changed: 131 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -46,7 +46,11 @@
46
46
importjava.util.ArrayList;
47
47
importjava.util.Arrays;
48
48
importjava.util.Comparator;
49
+
importjava.util.HashMap;
50
+
importjava.util.HashSet;
49
51
importjava.util.List;
52
+
importjava.util.Map;
53
+
importjava.util.Set;
50
54
importjava.util.stream.Collectors;
51
55
52
56
/**
@@ -61,6 +65,12 @@ public class AllScenariosPageCollection extends PageCollection implements Visita
61
65
privateStepstepFilter;
62
66
privateStringexceptionFilter;
63
67
68
+
// Lazily computed and cached lookup indices, so that rendering the "scenarios by X" pages for every
69
+
// unique tag/step/exception does not require a full re-scan of all reports and elements for each of them.
Copy file name to clipboardExpand all lines: engine/src/main/java/com/trivago/cluecumber/engine/rendering/pages/renderering/AllScenariosPageRenderer.java
+41-28Lines changed: 41 additions & 28 deletions
Original file line number
Diff line number
Diff line change
@@ -31,7 +31,9 @@
31
31
32
32
importjavax.inject.Inject;
33
33
importjavax.inject.Singleton;
34
+
importjava.util.Collections;
34
35
importjava.util.List;
36
+
importjava.util.Map;
35
37
importjava.util.stream.Collectors;
36
38
37
39
/**
@@ -116,17 +118,12 @@ public String getRenderedContentByTagFilter(
0 commit comments