Skip to content

Commit

Permalink
Remove String interning from o.e.index.Index. (#40350)
Browse files Browse the repository at this point in the history
`Index` interns its name and uuid. My guess is that the main goal is to avoid
having duplicate strings in the representation of the cluster state. However
I doubt it helps much given that we have many other objects in the cluster state
that we don't try to reuse, and interning has some cost. When looking into
 #40263 my profiler pointed to string interning because of the `Index` object
that is created in `QueryShardContext` as one of the bottlenecks of the
`can_match` phase.
  • Loading branch information
jpountz committed Mar 27, 2019
1 parent db03109 commit fed3580
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server/src/main/java/org/elasticsearch/index/Index.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public class Index implements Writeable, ToXContentObject {
private final String uuid;

public Index(String name, String uuid) {
this.name = Objects.requireNonNull(name).intern();
this.uuid = Objects.requireNonNull(uuid).intern();
this.name = Objects.requireNonNull(name);
this.uuid = Objects.requireNonNull(uuid);
}

/**
Expand Down

0 comments on commit fed3580

Please sign in to comment.