Skip to content

[FLINK-37735][serializer] Replace class.newInstance with constructor.newInstance #26863

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 6, 2025

Conversation

X-czh
Copy link
Contributor

@X-czh X-czh commented Aug 2, 2025

What is the purpose of the change

Lower PojoSerializer newInstance cost for higher deserialization performance.

Brief change log

Replace class.newInstance with constructor.newInstance for PojoSerializer and TupleSerializer.

The performance gets boosted by ~5% on the Flink POJO benchmark (tested on my laptop with JDK17.0.14), and the boost is more significant on simpler structs. More detailed performance analysis could be found at FLINK-37735.

image

Verifying this change

This change is already covered by existing POJO serializer tests.

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): (yes / no)
  • The public API, i.e., is any changed class annotated with @Public(Evolving): (yes / no)
  • The serializers: (yes / no / don't know)
  • The runtime per-record code paths (performance sensitive): (yes / no / don't know)
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: (yes / no / don't know)
  • The S3 file system connector: (yes / no / don't know)

Documentation

  • Does this pull request introduce a new feature? (yes / no)
  • If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)

@flinkbot
Copy link
Collaborator

flinkbot commented Aug 2, 2025

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

@X-czh X-czh force-pushed the FLINK-37735 branch 2 times, most recently from aab57a7 to 0d65e76 Compare August 3, 2025 03:17
@X-czh
Copy link
Contributor Author

X-czh commented Aug 3, 2025

@flinkbot run azure

1 similar comment
@X-czh
Copy link
Contributor Author

X-czh commented Aug 4, 2025

@flinkbot run azure

@nikita-ivanov-cc
Copy link

approve

@X-czh
Copy link
Contributor Author

X-czh commented Aug 6, 2025

@huwh @FangYongs Could you help take a look?

Copy link
Contributor

@huwh huwh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for your contribution.

@huwh huwh merged commit f859462 into apache:master Aug 6, 2025
@X-czh X-czh deleted the FLINK-37735 branch August 6, 2025 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants