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

perf: optimize Table::clone_structure by avoiding clones #1090

Merged
merged 1 commit into from
Apr 16, 2024

Conversation

Centril
Copy link
Contributor

@Centril Centril commented Apr 13, 2024

Description of Changes

Fixes #1082
Fixes #1084

Make Table::clone_structure cheaper by:

  • Arcing TableSchema, and this has benefits elsewhere too.
  • Arc<[_]>ing the visitor program instructions.

The data behind the Arcs very rarely change,
which is the perfect case for an Arc.

API and ABI breaking changes

None

Expected complexity level and risk

2

Testing

No semantic changes nor anything that is very interesting, so existing tests should suffice.

@Centril Centril added enhancement New feature or request performance labels Apr 13, 2024
@Centril Centril requested a review from cloutiertyler as a code owner April 13, 2024 01:36
@Centril Centril force-pushed the centril/arc-table-schema branch from 2df0cb5 to bcbbb55 Compare April 13, 2024 01:40
- Arcing `TableSchema`, and this has benefits elsewhere too.
- Arc<[_]>ing the visitor program instructions.

The data behind the Arcs very rarely change,
which is the perfect case for an Arc.
@Centril Centril force-pushed the centril/arc-table-schema branch from bcbbb55 to 6d87288 Compare April 13, 2024 21:04
@bfops bfops added the release-any To be landed in any release window label Apr 15, 2024
@Centril Centril requested a review from kazimuth April 15, 2024 18:19
Copy link
Contributor

@kazimuth kazimuth left a comment

Choose a reason for hiding this comment

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

Makes sense to me.

@@ -622,8 +623,7 @@ impl spacetimedb_commitlog::payload::txdata::Visitor for ReplayVisitor<'_> {
) -> std::result::Result<Self::Row, Self::Error> {
let schema = self
.committed_state
.schema_for_table(&ExecutionContext::default(), table_id)?
.into_owned();
.schema_for_table(&ExecutionContext::default(), table_id)?;
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be a noticeable improvement 👍

Copy link
Contributor

@cloutiertyler cloutiertyler left a comment

Choose a reason for hiding this comment

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

Had a call with @Centril. Makes sense to me.

@Centril Centril added this pull request to the merge queue Apr 16, 2024
Merged via the queue into master with commit f560101 Apr 16, 2024
7 checks passed
@Centril Centril deleted the centril/arc-table-schema branch April 16, 2024 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request release-any To be landed in any release window
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Arc the visitor_prog Arc TableSchema
5 participants