This utility function allows clearing of the cached value set up
@propertycache, if there is one.
Details
Details
- Reviewers
indygreg durin42 - Group Reviewers
hg-reviewers - Commits
- rHGbe6aa0cff8ea: util: add util.clearcachedproperty
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
Event Timeline
mercurial/util.py | ||
---|---|---|
936–937 | This pattern is commonly implemented using a `try..except KeyError around the del`. This avoids the double key lookup and I /think/ is faster. But since this is a super small function and won't be called with high frequency (I assume), it shouldn't be a problem. If a loop were so tight that it mattered, execution time would be dominated by Python function call overhead, not the low-level primitives inside the function. |
This pattern is commonly implemented using a `try..except KeyError around the del`. This avoids the double key lookup and I /think/ is faster.
But since this is a super small function and won't be called with high frequency (I assume), it shouldn't be a problem. If a loop were so tight that it mattered, execution time would be dominated by Python function call overhead, not the low-level primitives inside the function.