Page MenuHomePhabricator

Fix explosive runtime of detectCopiedCode()
ClosedPublic

Authored by epriestley on May 18 2014, 4:37 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Dec 28, 9:51 PM
Unknown Object (File)
Tue, Dec 17, 9:00 AM
Unknown Object (File)
Tue, Dec 10, 11:03 AM
Unknown Object (File)
Tue, Dec 10, 11:03 AM
Unknown Object (File)
Mon, Dec 9, 6:12 AM
Unknown Object (File)
Fri, Dec 6, 12:11 AM
Unknown Object (File)
Wed, Dec 4, 6:02 PM
Unknown Object (File)
Nov 28 2024, 1:11 PM
Subscribers
Tokens
"Mountain of Wealth" token, awarded by chad.

Details

Summary

Fixes T5041. Pretty sure this is the issue: if a diff contains a large number of identical lines longer than 30 characters, we end up paying O(N^2) for each set.

Instead, when N > 16, opt to pay 0.

Test Plan

Added a test which dropped from ~100s to ~0 after changes (this diff includes a reduced-strenght version of the test, since parsing a 4,000 line diff is a little bit pricey).

Diff Detail

Repository
rP Phabricator
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

epriestley retitled this revision from to Fix explosive runtime of detectCopiedCode().
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added a reviewer: btrahan.
btrahan edited edge metadata.

Hazzah!

This revision is now accepted and ready to land.May 19 2014, 6:22 PM
epriestley updated this revision to Diff 21854.

Closed by commit rPb64407d47e18 (authored by @epriestley).