Class FieldKey.Interner
java.lang.Object
io.github.mnesimiyilmaz.sql4json.engine.FieldKey.Interner
- Enclosing class:
FieldKey
Query-scoped interner — created once per query execution, GC'd when query finishes. Sharing identical path
strings and FieldKey instances across rows reduces GC pressure.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Interner
public Interner()Creates a new empty interner.
-
-
Method Details
-
intern
Interns a string, returning the canonical instance.Hand-rolled get/put pair instead of
computeIfAbsent(s, k -> k)— the lambda form allocates a fresh closure on every call (cache hit or miss), which dominated allocations during JsonParser-heavy workloads (profiler: 537 MB ofFieldKey$Interner$$Lambdaon a 512 MB GROUP BY query).- Parameters:
s- the string to intern- Returns:
- the canonical instance of the string
-
internFieldKey
Interns a FieldKey, returning the canonical instance for the given key path.Lambda-free hot path — see
intern(String)for the rationale.- Parameters:
key- the field key path to intern- Returns:
- the canonical FieldKey instance for the given path
-