bvolpato opened a new pull request, #39619: URL: https://github.com/apache/beam/pull/39619
`RowCoderGenerator` currently creates and loads one ByteBuddy class for every uncached schema. Generated `encode` and `decode` methods only load instance fields and call existing Java delegates, so class generation adds startup time, allocation, metaspace pressure, and class-loader complexity without specializing field encoding. This replaces generated classes with one immutable `CustomCoder<Row>` implementation while preserving schema UUID caching, encoding-position overrides, component coders, and existing encode/decode algorithms. It also adds JMH coverage for uncached coder creation and steady-state encoding/decoding. ## Benchmarks JDK 17, same host, three isolated JVM forks. Generation includes schema construction; `buildSchema` is a control. | Benchmark | `master` | This PR | Change | | --- | ---: | ---: | ---: | | Uncached coder creation | 5,138.469 ± 422.881 µs/op | 328.614 ± 30.207 µs/op | 15.6x faster | | Uncached coder allocation | 554,862.4 ± 2,135.1 B/op | 17,926.4 ± 33.0 B/op | 31.0x lower | | Schema construction control | 147.588 ± 22.855 µs/op | 145.541 ± 24.375 µs/op | unchanged | Command: ```sh ./gradlew :sdks:java:core:jmh:jmh --args='org.apache.beam.sdk.jmh.coders.RowCoderGenerationBenchmark -prof gc -f 3 -foe=true' ``` Steady-state results use identical benchmarks and three forks: | Operation | Static encoding | `master` ns/op | This PR ns/op | | --- | --- | ---: | ---: | | decode | false | 59.354 ± 0.892 | 60.901 ± 1.137 | | decode | true | 50.046 ± 1.455 | 50.931 ± 0.885 | | encode | false | 61.872 ± 1.607 | 59.405 ± 1.554 | | encode | true | 45.537 ± 0.958 | 45.286 ± 1.026 | All old/new confidence intervals overlap, showing no material steady-state regression. ## Wire compatibility and testing Encoding and decoding algorithms are unchanged. Java passes Beam's exact standard-coder vectors, including `beam:coder:row:v1` vectors produced by Python. - `./gradlew :runners:java-fn-execution:test --tests org.apache.beam.runners.fnexecution.wire.CommonCoderTest` (227 passed) - `./gradlew :sdks:java:core:test` (full core suite passed; `RowCoderTest` 28/28 and `SchemaCoderTest` 19/19) - `./gradlew :sdks:java:core:spotlessApply :sdks:java:core:jmh:spotlessApply` - Old/new `RowCoderBenchmark` JMH runs for dynamic and static encodings ------------------------ - [ ] No existing issue to link. - [ ] No `CHANGES.md` entry; internal performance change with unchanged API and wire format. - [x] Small contribution; ICLA not applicable. -- 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]
