Page MenuHomePhabricator

Fix an issue with the Herald engine field value cache
ClosedPublic

Authored by epriestley on Mar 9 2016, 6:26 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Apr 25, 2:33 AM
Unknown Object (File)
Fri, Apr 19, 4:19 PM
Unknown Object (File)
Tue, Apr 9, 2:34 AM
Unknown Object (File)
Mon, Apr 1, 12:01 AM
Unknown Object (File)
Sun, Mar 31, 10:54 AM
Unknown Object (File)
Mar 18 2024, 6:05 PM
Unknown Object (File)
Mar 18 2024, 4:25 PM
Unknown Object (File)
Mar 15 2024, 1:51 PM
Subscribers
None
Tokens
"Like" token, awarded by Luke081515.2.

Details

Summary

To improve the performance of Herald, we attempt to generate the value for each field (e.g., a task title) only once.

For most field values this is cheap, but for some (like a commit's branches) it can be quite expensive. We only want to pay this cost once, so we cache field values.

However, D12957 accidentally added a check where we bypass the cache and generate the value for every field, before reading the cache. This causes us to generate each field for every rule that uses it, plus one extra time.

Instead, use the cache for this check, too. Also allow the cache to cache null, since it can be expensive to generate null even though the value isn't too interesting.

The value of this early hit isn't even used (we only care if it throws or not).

Test Plan
  • Wrote a rule like "if any condition matches: branches contain a, branches contain b, branches contain c".
  • Put phlog(new Exception()) in DiffusionCommitBranchesHeraldField.
  • Before patch, saw bin/repository reparse --herald <any commit> compute branches three times.
  • After patch, saw only one computation.
  • Verified field values in the transcript view

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

epriestley retitled this revision from to Fix an issue with the Herald engine field value cache.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added a reviewer: chad.
chad edited edge metadata.
This revision is now accepted and ready to land.Mar 9 2016, 6:27 PM
This revision was automatically updated to reflect the committed changes.