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.
This commit is contained in:
Adrien Grand 2019-03-28 09:31:42 +01:00 committed by GitHub
parent 5485efa2af
commit 2326a3dccb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -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);
}
/**