• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

wikimedia / parsoid / 1011
85%

Build:
DEFAULT BRANCH: master
Ran 24 Jun 2016 08:03PM UTC
Jobs 3
Files 79
Run time 30s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
1011

push

travis-ci

subbuss
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

Jobs
ID Job ID Ran Files Coverage
1 1011.1 24 Jun 2016 08:03PM UTC 0
83.77
Travis Job 1011.1
2 1011.2 24 Jun 2016 08:03PM UTC 0
83.74
Travis Job 1011.2
3 1011.3 24 Jun 2016 08:03PM UTC 0
83.74
Travis Job 1011.3
Source Files on build 1011
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #1011
  • dd8e644d on github
  • Prev Build on master (#1010)
  • Next Build on master (#1012)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc