mosche opened a new pull request, #27534:
URL: https://github.com/apache/beam/pull/27534

   The conversion of rows to the external object is rather inefficient. The 
code to convert Row fields to the external field types required for the 
constructor / setters in `FromRowUsingCreator` is branch heavy and rather hard 
to optimize for Java's JIT compiler.
   
   ### Functional observations:
   
   Maps and Collections / Lists are currently handled inconsistently:
   - Maps are eagerly rewritten / copied, making their usage rather expensive. 
The user object will contain fully operable maps.
   - Collections / Lists are converted using Guava views (e.g. 
`Lists.transform`). The user object will contain collections that can mostly 
just be read from, THOUGH it's possible to remove items from the underlying 
collection potentially causing issues.
   
   
   ###  Changes in this PR:
   - On first usage, generate a converter function for every field based on 
schema & type information. No more branching required when applying the 
function. This way the code is also better JIT optimizable.
   - [TBD] Depending on types a conversion might not be required at all, in 
this case the conversion is skipped using an identity converter, e.g. this is 
the case for a map of primitive types. Though, passing references of maps / 
collections could potentially cause issues in certain situations (but this is 
already a given, see above).
   
   ### Benchmark results
   
   ![Screenshot 2023-07-17 at 17 27 
53](https://github.com/apache/beam/assets/1401430/4d7abf25-c32c-436c-b3e5-c9f1fffa14bf)
   
   Historic benchmarks for `GetterBasedSchemaProvider` are available here 
(master branch only): 
https://s.apache.org/beam-community-metrics/d/kllfR2vVk/java-jmh-benchmarks?orgId=1
   
   Closes #27533
   
   
   ------------------------
   
   Thank you for your contribution! Follow this checklist to help us 
incorporate your contribution quickly and easily:
   
    - [ ] Mention the appropriate issue in your description (for example: 
`addresses #123`), if applicable. This will automatically add a link to the 
pull request in the issue. If you would like the issue to automatically close 
on merging the pull request, comment `fixes #<ISSUE NUMBER>` instead.
    - [ ] Update `CHANGES.md` with noteworthy changes.
    - [ ] If this contribution is large, please file an Apache [Individual 
Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   See the [Contributor Guide](https://beam.apache.org/contribute) for more 
tips on [how to make review process 
smoother](https://beam.apache.org/contribute/get-started-contributing/#make-the-reviewers-job-easier).
   
   To check the build health, please visit 
[https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md](https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md)
   
   GitHub Actions Tests Status (on master branch)
   
------------------------------------------------------------------------------------------------
   [![Build python source distribution and 
wheels](https://github.com/apache/beam/workflows/Build%20python%20source%20distribution%20and%20wheels/badge.svg?branch=master&event=schedule)](https://github.com/apache/beam/actions?query=workflow%3A%22Build+python+source+distribution+and+wheels%22+branch%3Amaster+event%3Aschedule)
   [![Python 
tests](https://github.com/apache/beam/workflows/Python%20tests/badge.svg?branch=master&event=schedule)](https://github.com/apache/beam/actions?query=workflow%3A%22Python+Tests%22+branch%3Amaster+event%3Aschedule)
   [![Java 
tests](https://github.com/apache/beam/workflows/Java%20Tests/badge.svg?branch=master&event=schedule)](https://github.com/apache/beam/actions?query=workflow%3A%22Java+Tests%22+branch%3Amaster+event%3Aschedule)
   [![Go 
tests](https://github.com/apache/beam/workflows/Go%20tests/badge.svg?branch=master&event=schedule)](https://github.com/apache/beam/actions?query=workflow%3A%22Go+tests%22+branch%3Amaster+event%3Aschedule)
   
   See [CI.md](https://github.com/apache/beam/blob/master/CI.md) for more 
information about GitHub Actions CI.
   


-- 
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]

Reply via email to