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

Optimize restore_savepoint() #923

Merged
merged 1 commit into from
Dec 27, 2024
Merged

Optimize restore_savepoint() #923

merged 1 commit into from
Dec 27, 2024

Conversation

cberner
Copy link
Owner

@cberner cberner commented Dec 26, 2024

This restores and fixes the optimization that was removed in baa86e7

restore_savepoint() now scales with the number of database modifications since the savepoint was captured, rather than the size of the database

savepoint_benchmark is now ~35x faster for an 8GiB database file

Benchmarks:
master:

+---------+----------+------------------------+---------------------+
| DB size | insert() | persistent_savepoint() | restore_savepoint() |
+===================================================================+
| 129MiB  | 7693ns   | 685us                  | 18807us             |
|---------+----------+------------------------+---------------------|
| 257MiB  | 7456ns   | 510us                  | 62092us             |
|---------+----------+------------------------+---------------------|
| 514MiB  | 7126ns   | 379us                  | 152715us            |
|---------+----------+------------------------+---------------------|
| 1028MiB | 7678ns   | 427us                  | 346066us            |
|---------+----------+------------------------+---------------------|
| 2056MiB | 11429ns  | 1402us                 | 1173873us           |
|---------+----------+------------------------+---------------------|
| 4096MiB | 17383ns  | 2169us                 | 2946756us           |
|---------+----------+------------------------+---------------------|
| 8193MiB | 18706ns  | 672us                  | 5288360us           |
+---------+----------+------------------------+---------------------+

Optimized (this PR):

+---------+----------+------------------------+---------------------+
| DB size | insert() | persistent_savepoint() | restore_savepoint() |
+===================================================================+
| 129MiB  | 7153ns   | 656us                  | 2097us              |
|---------+----------+------------------------+---------------------|
| 257MiB  | 7613ns   | 498us                  | 3689us              |
|---------+----------+------------------------+---------------------|
| 514MiB  | 7930ns   | 520us                  | 8685us              |
|---------+----------+------------------------+---------------------|
| 1028MiB | 9116ns   | 679us                  | 23494us             |
|---------+----------+------------------------+---------------------|
| 2056MiB | 12111ns  | 1622us                 | 33498us             |
|---------+----------+------------------------+---------------------|
| 4096MiB | 18542ns  | 2163us                 | 67417us             |
|---------+----------+------------------------+---------------------|
| 8193MiB | 20877ns  | 1310us                 | 145174us            |
+---------+----------+------------------------+---------------------+

This restores and fixes the optimization that was removed in baa86e7

restore_savepoint() now scales with the number of database modifications
since the savepoint was captured, rather than the size of the database

savepoint_benchmark is now ~35x faster for an 8GiB database file
@cberner cberner merged commit 51ca54c into master Dec 27, 2024
3 checks passed
@cberner cberner deleted the restore_opt branch December 27, 2024 00:01
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.

1 participant