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

Speed up QualifiedName constructor #15352

Conversation

skrzypo987
Copy link
Member

Description

A small performance tweak.
I noticed that about 1% of analysis time in some of my huge queries was spent in the constructor of QualifiedName in stream logic.

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`)

@cla-bot cla-bot bot added the cla-signed label Dec 9, 2022
@@ -63,7 +62,7 @@ private QualifiedName(List<Identifier> originalParts)
this.parts = originalParts.stream()
.map(QualifiedName::mapIdentifier)
.collect(toImmutableList());
this.name = Joiner.on(".").join(parts);
this.name = String.join(".", parts);
Copy link
Member

Choose a reason for hiding this comment

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

Is this just a cleanup? Or part of Speed up QualifiedName constructor?

Copy link
Member Author

Choose a reason for hiding this comment

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

The java version of this is indeed faster, but I don't think faster enough to make a difference. So this is more of a cosmetic change

@kokosing
Copy link
Member

kokosing commented Dec 9, 2022

A small performance tweak.

Any numbers?

The QualifiedName constructor is used for every identifier during analysis phase
and may take significant part of wall time for huge queries.
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.

@kokosing @findepi AC

Any numbers?

Not really. The difference is small, barely above error margin for a typical microbenchmark.

@@ -63,7 +62,7 @@ private QualifiedName(List<Identifier> originalParts)
this.parts = originalParts.stream()
.map(QualifiedName::mapIdentifier)
.collect(toImmutableList());
this.name = Joiner.on(".").join(parts);
this.name = String.join(".", parts);
Copy link
Member Author

Choose a reason for hiding this comment

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

The java version of this is indeed faster, but I don't think faster enough to make a difference. So this is more of a cosmetic change

@skrzypo987 skrzypo987 force-pushed the skrzypo/135-speed-up-qualified-name-constructor branch from fce81a2 to c0d09fa Compare December 12, 2022 07:51
@skrzypo987
Copy link
Member Author

@kokosing @findepi ping

@kokosing kokosing merged commit 667194e into trinodb:master Dec 16, 2022
@github-actions github-actions bot added this to the 404 milestone Dec 16, 2022
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