nssalian opened a new pull request, #3481: URL: https://github.com/apache/parquet-java/pull/3481
### Rationale for this change Profiling in [3452](https://github.com/apache/parquet-java/pull/3452) identified `Variant.getFieldAtIndex()` and metadata string lookups as hotspots during variant reads. Every call to `getFieldByKey`, `getFieldAtIndex`, and `getElementAtIndex` re-parses headers and re-allocates objects that could be cached. ### What changes are included in this PR? Adds lazy caching to `Variant.java` for metadata strings, object headers, and array headers. Field lookups in `getFieldByKey` now defer value construction until a match is found, and child Variants share the parent's metadata cache. Also removes two unused static helper methods. Includes @steveloughran's string converter optimization from #3452: `VariantBuilder.appendAsString(Binary)` and its use in `VariantConverters`. ### Are these changes tested? Ran the benchmarks from [3452](https://github.com/apache/parquet-java/pull/3452) locally Before: ``` Benchmark (depth) (fieldCount) Mode Cnt Score Error Units VariantBuilderBenchmark.deserializeVariant Flat 200 ss 5 11248.133 ± 696.176 us/op VariantBuilderBenchmark.deserializeVariant Nested 200 ss 5 15531.391 ± 1025.506 us/op ``` After: ``` Benchmark (depth) (fieldCount) Mode Cnt Score Error Units VariantBuilderBenchmark.deserializeVariant Flat 200 ss 5 4601.967 ± 4434.474 us/op VariantBuilderBenchmark.deserializeVariant Nested 200 ss 5 7457.942 ± 3645.281 us/op ``` ### Are there any user-facing changes? No. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
