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

sql/catalog/resolver: remove an allocation, add a benchmark #72817

Merged
merged 1 commit into from
Nov 17, 2021

Conversation

ajwerner
Copy link
Contributor

We didn't need to allocate this name except on error paths. Make that lazy.

The added benchmark also shows that we do horrifically badly when using
user-defined schemas and search_path. Yay for benchmarks.

name                                                                    old time/op    new time/op    delta
ResolveExistingObject/CREATE_TABLE_foo_()foo-16                           2.18µs ± 5%    2.03µs ± 2%    -6.96%  (p=0.008 n=5+5)
ResolveExistingObject/CREATE_SCHEMA_sc;CREATE_TABLE_sc.foo_()sc.foo-16    1.59µs ± 4%    1.53µs ± 4%      ~     (p=0.063 n=5+5)
ResolveExistingObject/CREATE_SCHEMA_sc;CREATE_TABLE_sc.foo_()foo-16       60.5µs ± 4%    60.1µs ± 6%      ~     (p=0.690 n=5+5)

name                                                                    old alloc/op   new alloc/op   delta
ResolveExistingObject/CREATE_TABLE_foo_()foo-16                            72.4B ± 1%      7.6B ±18%   -89.50%  (p=0.008 n=5+5)
ResolveExistingObject/CREATE_SCHEMA_sc;CREATE_TABLE_sc.foo_()sc.foo-16     69.4B ± 1%      5.0B ± 0%   -92.80%  (p=0.008 n=5+5)
ResolveExistingObject/CREATE_SCHEMA_sc;CREATE_TABLE_sc.foo_()foo-16       11.2kB ± 0%    11.1kB ± 0%    -0.56%  (p=0.008 n=5+5)

name                                                                    old allocs/op  new allocs/op  delta
ResolveExistingObject/CREATE_TABLE_foo_()foo-16                             1.00 ± 0%      0.00       -100.00%  (p=0.008 n=5+5)
ResolveExistingObject/CREATE_SCHEMA_sc;CREATE_TABLE_sc.foo_()sc.foo-16      1.00 ± 0%      0.00       -100.00%  (p=0.008 n=5+5)
ResolveExistingObject/CREATE_SCHEMA_sc;CREATE_TABLE_sc.foo_()foo-16         75.0 ± 0%      74.0 ± 0%    -1.33%  (p=0.008 n=5+5)

Release note: None

We didn't need to allocate this name except on error paths. Make that lazy.

The added benchmark also shows that we do horrifically badly when using
user-defined schemas and `search_path`. Yay for benchmarks.

```
name                                                                    old time/op    new time/op    delta
ResolveExistingObject/CREATE_TABLE_foo_()foo-16                           2.18µs ± 5%    2.03µs ± 2%    -6.96%  (p=0.008 n=5+5)
ResolveExistingObject/CREATE_SCHEMA_sc;CREATE_TABLE_sc.foo_()sc.foo-16    1.59µs ± 4%    1.53µs ± 4%      ~     (p=0.063 n=5+5)
ResolveExistingObject/CREATE_SCHEMA_sc;CREATE_TABLE_sc.foo_()foo-16       60.5µs ± 4%    60.1µs ± 6%      ~     (p=0.690 n=5+5)

name                                                                    old alloc/op   new alloc/op   delta
ResolveExistingObject/CREATE_TABLE_foo_()foo-16                            72.4B ± 1%      7.6B ±18%   -89.50%  (p=0.008 n=5+5)
ResolveExistingObject/CREATE_SCHEMA_sc;CREATE_TABLE_sc.foo_()sc.foo-16     69.4B ± 1%      5.0B ± 0%   -92.80%  (p=0.008 n=5+5)
ResolveExistingObject/CREATE_SCHEMA_sc;CREATE_TABLE_sc.foo_()foo-16       11.2kB ± 0%    11.1kB ± 0%    -0.56%  (p=0.008 n=5+5)

name                                                                    old allocs/op  new allocs/op  delta
ResolveExistingObject/CREATE_TABLE_foo_()foo-16                             1.00 ± 0%      0.00       -100.00%  (p=0.008 n=5+5)
ResolveExistingObject/CREATE_SCHEMA_sc;CREATE_TABLE_sc.foo_()sc.foo-16      1.00 ± 0%      0.00       -100.00%  (p=0.008 n=5+5)
ResolveExistingObject/CREATE_SCHEMA_sc;CREATE_TABLE_sc.foo_()foo-16         75.0 ± 0%      74.0 ± 0%    -1.33%  (p=0.008 n=5+5)
```

Release note: None
@ajwerner ajwerner requested a review from a team November 16, 2021 15:24
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Collaborator

@fqazi fqazi left a comment

Choose a reason for hiding this comment

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

Reviewed 3 of 4 files at r1, all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @fqazi)

@ajwerner
Copy link
Contributor Author

@fqazi was that an approval comment?

Copy link
Collaborator

@fqazi fqazi left a comment

Choose a reason for hiding this comment

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

Yes, forgot to hit LGTM

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @fqazi)

Copy link
Collaborator

@fqazi fqazi left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @fqazi)

@ajwerner
Copy link
Contributor Author

TFTR

bors r+

@craig
Copy link
Contributor

craig bot commented Nov 17, 2021

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Nov 17, 2021

Build succeeded:

@craig craig bot merged commit 45d2d36 into cockroachdb:master Nov 17, 2021
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.

3 participants