Skip to content

Commit

Permalink
use property to make interning configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
awildturtok committed Apr 9, 2024
1 parent c956935 commit 5819348
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,20 @@ public static StringStoreString create(int size) {

@JsonCreator
public static StringStoreString withInternedStrings(String[] values) {
if(shouldIntern()) {
for (int index = 0; index < values.length; index++) {
values[index] = values[index] != null ? values[index].intern() : null;
}
}

return new StringStoreString(values);
}

private static boolean shouldIntern() {
//TODO use mixin or properly wire this property
return "yes".equals(System.getProperty("cq.intern", "no"));
}

@Override
public boolean has(int event) {
return values[event] != null;
Expand Down

0 comments on commit 5819348

Please sign in to comment.