Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(104)

Unified Diff: runtime/vm/hash_table.h

Issue 2575913002: VM: Only update hash table stats when needed for printing. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/hash_table.h
diff --git a/runtime/vm/hash_table.h b/runtime/vm/hash_table.h
index 05d69fc4f83813341ad8ebab9d68988c49396016..61db830478575487cb3f8240aceea7d5df84924f 100644
--- a/runtime/vm/hash_table.h
+++ b/runtime/vm/hash_table.h
@@ -287,17 +287,23 @@ class HashTable : public ValueObject {
intptr_t NumGT25Collisions() const {
return GetSmiValueAt(kNumGT25LookupsIndex);
}
- void UpdateGrowth() const { AdjustSmiValueAt(kNumGrowsIndex, 1); }
- void UpdateCollisions(intptr_t collisions) const {
- if (data_->raw()->IsVMHeapObject()) {
- return;
+ void UpdateGrowth() const {
+ if (KeyTraits::ReportStats()) {
+ AdjustSmiValueAt(kNumGrowsIndex, 1);
}
- if (collisions < 5) {
- AdjustSmiValueAt(kNumLT5LookupsIndex, 1);
- } else if (collisions < 25) {
- AdjustSmiValueAt(kNumLT25LookupsIndex, 1);
- } else {
- AdjustSmiValueAt(kNumGT25LookupsIndex, 1);
+ }
+ void UpdateCollisions(intptr_t collisions) const {
+ if (KeyTraits::ReportStats()) {
+ if (data_->raw()->IsVMHeapObject()) {
+ return;
+ }
+ if (collisions < 5) {
+ AdjustSmiValueAt(kNumLT5LookupsIndex, 1);
+ } else if (collisions < 25) {
+ AdjustSmiValueAt(kNumLT25LookupsIndex, 1);
+ } else {
+ AdjustSmiValueAt(kNumGT25LookupsIndex, 1);
+ }
}
}
void PrintStats() const {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698