Page MenuHomePhabricator

When computing revision ownership, cache some intermediate results for performance
ClosedPublic

Authored by epriestley on Feb 27 2017, 4:05 PM.
Tags
None
Referenced Files
F15424261: D17424.diff
Sat, Mar 22, 9:11 PM
F15411152: D17424.diff
Wed, Mar 19, 8:52 AM
F15409881: D17424.id41893.diff
Wed, Mar 19, 5:46 AM
F15409870: D17424.diff
Wed, Mar 19, 5:44 AM
F15409449: D17424.diff
Wed, Mar 19, 4:32 AM
F15409120: D17424.diff
Wed, Mar 19, 3:20 AM
F15408899: D17424.diff
Wed, Mar 19, 2:07 AM
F15408723: D17424.diff
Wed, Mar 19, 12:54 AM
Subscribers
None

Details

Summary

Ref T12319. With large datasets, the computation of which packages own paths in a revision is needlessly slow.

Improve performance through caching:

  • Cache which paths belong to each repository.
  • Cache the split fragments of each path.
  • Cache the path fragment counts.
  • Micro-optimize accessing $this->path.
Test Plan
  • Used bin/lipsum to generate 4,000 packages with 150,000 paths.
  • Created a revision affecting 100 paths in phabricator/ (these paths mostly overlap with bin/lipsum path rules, since Lipsum uses Phabricator-like rules to generate paths).
  • Before optimizations, this revision spent about 5.5 seconds computing paths.
  • After optimizations, it spends about 275ms.

Screen Shot 2017-02-27 at 8.01.39 AM.png (1×2 px, 375 KB)

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable