Skip to content

Commit 2326a3d

Browse files
authored
Remove String interning from o.e.index.Index. (#40350) (#40517)
`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.
1 parent 5485efa commit 2326a3d

File tree

1 file changed

+2
-2
lines changed
  • server/src/main/java/org/elasticsearch/index

1 file changed

+2
-2
lines changed

server/src/main/java/org/elasticsearch/index/Index.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ public class Index implements Writeable, ToXContentObject {
5050
private final String uuid;
5151

5252
public Index(String name, String uuid) {
53-
this.name = Objects.requireNonNull(name).intern();
54-
this.uuid = Objects.requireNonNull(uuid).intern();
53+
this.name = Objects.requireNonNull(name);
54+
this.uuid = Objects.requireNonNull(uuid);
5555
}
5656

5757
/**

0 commit comments

Comments
 (0)