Page MenuHomePhabricator

Count lines in build log slices more cheaply
ClosedPublic

Authored by epriestley on Jul 27 2018, 8:33 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Apr 25, 1:26 AM
Unknown Object (File)
Wed, Apr 24, 9:42 AM
Unknown Object (File)
Apr 6 2024, 12:10 AM
Unknown Object (File)
Mar 23 2024, 9:20 AM
Unknown Object (File)
Feb 24 2024, 4:41 PM
Unknown Object (File)
Jan 31 2024, 1:21 PM
Unknown Object (File)
Jan 15 2024, 9:56 AM
Unknown Object (File)
Dec 22 2023, 12:06 AM
Subscribers
Restricted Owners Package

Details

Summary

See PHI766. Ref T13164. Build log chunk processing does a preg_split() on slices, but this isn't terribly efficient.

We can get the same count more cheaply by just using substr_count() a few times.

(I also tried preg_match_all(), which was between the two in speed.)

Test Plan
  • Used bin/harbormaster rebuild-log --id X --force to rebuild logs. Verified that the linemap is identical before/after this change.
  • Saw local time for the 18MB log in PHI766 drop from ~1.7s to ~900ms, and preg_split() drop out of the profiler (we're now spending the biggest chunk of time on gzdeflate()).

Diff Detail

Repository
rP Phabricator
Branch
buildlog1
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 20526
Build 27876: Run Core Tests
Build 27875: arc lint + arc unit

Event Timeline

Owners added a subscriber: Restricted Owners Package.Jul 27 2018, 8:33 PM
This revision is now accepted and ready to land.Jul 29 2018, 4:05 PM

This is also mathematically equivalent to $n_r + $n_n - $n_rn I suppose, but it's probably clearer like this.

This revision was automatically updated to reflect the committed changes.