aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/events/Event.java
diff options
context:
space:
mode:
authorGravatar ulfjack <ulfjack@google.com>2017-11-30 07:15:05 -0800
committerGravatar Copybara-Service <copybara-piper@google.com>2017-11-30 07:17:39 -0800
commit5670fb29734483f8d2008cb01dddc5f3dd129cf9 (patch)
tree0430e14fe9bdf942e1ed346f63c4c1cf89012e87 /src/main/java/com/google/devtools/build/lib/events/Event.java
parent16a5bd9fde00a418e16f30e18270aeb198d36218 (diff)
Simplify tagged event handling.
Don't make copies of Events on replay. The same events may be replayed a lot, so it's better to copy before storing the events. Also avoid a copy if the tag doesn't actually change. The intent of this change is to reduce gc churn on incremental builds. When I wrote this change (~a year ago), this was a noticable source of gc churn in some benchmarks I ran at the time. PiperOrigin-RevId: 177450696
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/events/Event.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/events/Event.java3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/events/Event.java b/src/main/java/com/google/devtools/build/lib/events/Event.java
index 61db7dcad9..5bf5b1dd05 100644
--- a/src/main/java/com/google/devtools/build/lib/events/Event.java
+++ b/src/main/java/com/google/devtools/build/lib/events/Event.java
@@ -66,6 +66,9 @@ public final class Event implements Serializable {
}
public Event withTag(String tag) {
+ if (Objects.equals(tag, this.tag)) {
+ return this;
+ }
if (this.message != null) {
return new Event(this.kind, this.location, this.message, tag);
} else {