Page MenuHomePhabricator

Fix an issue with the Herald engine field value cache

Authored by epriestley on Mar 9 2016, 6:26 PM.
Referenced Files
F13303834: D15451.diff
Sat, Jun 8, 7:23 AM
F13286824: D15451.diff
Tue, Jun 4, 7:44 AM
F13277879: D15451.id37240.diff
Fri, May 31, 2:56 PM
F13273761: D15451.diff
Fri, May 31, 2:36 AM
F13233947: D15451.diff
Tue, May 21, 2:40 AM
F13213872: D15451.diff
Fri, May 17, 8:10 AM
F13181662: D15451.id37240.diff
May 9 2024, 2:25 PM
Unknown Object (File)
May 7 2024, 8:39 AM
"Like" token, awarded by Luke081515.2.



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

rP Phabricator
Lint Not Applicable
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.