|
Ran
|
Jobs
3
|
Files
79
|
Run time
30s
|
Badge
README BADGES
|
push
travis-ci
Template wrapping: Eliminate pathological tpl-range nesting scenario wikidata.org/wiki/Wikidata:Database_reports/items_without_claims_categories/enwiki and other such pages on wikidata have been timing out regularly for several months now. It turns out that this was exercising a pathological scenario in template wrapping. That page has ~4000 transclusions of the form: {{TR noclaims site|...}} This transclusion generates a <tr>...</tr> which then causes the start and end-template marker meta tags to lie outside the <tr> which seems to be causing template ranges to expand to the entire table (that behavior will be investigated separately to see if we can make it stick to the <tr> instead). So, we effectively have ~4K transclusions whose template wrapping range is identical (the entire table). Given a set of ranges, the findToplevelNonOverlappingRanges algorithm tries to find how ranges nest within one another. Given ranges A & B that overlap perfectly, we could mark A nested in B or vice versa. Normally, this shouldn't be an issue since no matter which one we pick as the "outermost" range, the whole table will get wrapped. However, the algorithm also has code to prevent nesting cycles. This cycle detection code encounters pathological behavior on this page. We have ranges R_1 .. R_4000 where R_n is being marked as nested in R_n+1. So, you now have this nesting tree that ends up as a long chain from R_1 ... R_n for all values of n. The cycle-detection code uses this nesting tree to prevent cyclical nesting and this ends up walking these n-long paths for every value of n and thus has O(n^2) behavior. A better nesting tree would be to mark R_2 .. R_4000 as being nested in R_1. So, given ranges A & B that overlap perfectly, this patch adds a new test to ensure that B is marked nested in A whenever B's starting offset is larger than A's offset. With this fix, the tpl-wrapping code finishes rapidly and the page parses without a timeout. Bug: T119883 Change-Id: Iaaa2fc2cf
12973 of 15483 relevant lines covered (83.79%)
63891.74 hits per line
| ID | Job ID | Ran | Files | Coverage | |
|---|---|---|---|---|---|
| 1 | 1011.1 | 0 |
83.77 |
Travis Job 1011.1 | |
| 2 | 1011.2 | 0 |
83.74 |
Travis Job 1011.2 | |
| 3 | 1011.3 | 0 |
83.74 |
Travis Job 1011.3 |