Skip to content
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

Extract meaningful methods in join operator #16468

Conversation

skrzypo987
Copy link
Member

Description

Just a simple refactoring

Additional context and related issues

Release notes

(x) This is not user-visible or docs only and no release notes are required.
( ) Release notes are required, please propose a release note for me.
( ) Release notes are required, with the following suggested text:

# Section
* Fix some things. ({issue}`issuenumber`)

skrzypo987 added 2 commits March 9, 2023 10:43
JFR profiling will also be easier when code is split into more methods
@cla-bot cla-bot bot added the cla-signed label Mar 9, 2023
Copy link
Member

@lukasz-stec lukasz-stec left a comment

Choose a reason for hiding this comment

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

good idea + lgtm

@skrzypo987
Copy link
Member Author

good idea

Just for the record, it was your idea in the first place.

Copy link
Member

@sopel39 sopel39 left a comment

Choose a reason for hiding this comment

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

Could this have perf impact? Did JMH change?

// look for an empty slot or a slot containing this key
while (keys[pos] != -1) {
int currentKey = keys[pos];
if (hash == positionToHashes[currentKey] && positionEqualsPositionIgnoreNulls(currentKey, realPosition)) {
Copy link
Member

Choose a reason for hiding this comment

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

missing cast?

Copy link
Member Author

Choose a reason for hiding this comment

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

hash is now casted in method invocation, line 122

Copy link
Member Author

@skrzypo987 skrzypo987 left a comment

Choose a reason for hiding this comment

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

Could this have perf impact? Did JMH change?

It's quite improbable, for two reasons:

  • Those methods are inlined by JIT, if applicable
  • Every extracted method either operates on batch of values or performs multiple random memory accesses. So the methods are not cheap and cost of invocation is negligible.

// look for an empty slot or a slot containing this key
while (keys[pos] != -1) {
int currentKey = keys[pos];
if (hash == positionToHashes[currentKey] && positionEqualsPositionIgnoreNulls(currentKey, realPosition)) {
Copy link
Member Author

Choose a reason for hiding this comment

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

hash is now casted in method invocation, line 122

@sopel39 sopel39 merged commit 350a361 into trinodb:master Mar 10, 2023
@github-actions github-actions bot added this to the 411 milestone Mar 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants