Skip to content

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

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
ajwerner:ajwerner/remove-an-allocation
Nov 17, 2021
Merged

sql/catalog/resolver: remove an allocation, add a benchmark#72817
craig[bot] merged 1 commit intocockroachdb:masterfrom
ajwerner:ajwerner/remove-an-allocation

Conversation

@ajwerner
Copy link
Copy Markdown
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
Copy Markdown
Member

This change is Reviewable

Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

@fqazi was that an approval comment?

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

TFTR

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Nov 17, 2021

Build failed (retrying...):

@craig
Copy link
Copy Markdown
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