Skip to content

Speed up sqlite3 tests #108550

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

Closed
erlend-aasland opened this issue Aug 27, 2023 · 1 comment
Closed

Speed up sqlite3 tests #108550

erlend-aasland opened this issue Aug 27, 2023 · 1 comment
Assignees
Labels
3.11 only security fixes 3.12 only security fixes 3.13 bugs and security fixes tests Tests in the Lib/test dir type-feature A feature request or enhancement

Comments

@erlend-aasland
Copy link
Contributor

erlend-aasland commented Aug 27, 2023

Feature or enhancement

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Proposal:

On my MacBook Pro M1, the sqlite3 test suite takes between 1.7 and up to 3 seconds to run. This is caused by the following inefficiencies:

  • the sqlite3 CLI tests are run by launching Python in a new process
  • tests relying on locking are using relatively large busy handler timeouts

With the following improvements, I can run the sqlite3 test suite in 350 milliseconds:

  • refactor the CLI so we can invoke it and mock command-line arguments simply by importing the main() and passing a list of strings to it
  • disable the busy handler for all concurrency tests; we have full control over the order of the SQLite C API calls, so we can safely do this

Linked PRs

@erlend-aasland erlend-aasland added type-feature A feature request or enhancement 3.11 only security fixes 3.12 only security fixes 3.13 bugs and security fixes labels Aug 27, 2023
@erlend-aasland erlend-aasland self-assigned this Aug 27, 2023
@erlend-aasland erlend-aasland moved this to In Progress in sqlite3 issues Aug 27, 2023
erlend-aasland added a commit to erlend-aasland/cpython that referenced this issue Aug 27, 2023
Refactor the CLI so we can easily invoke it and mock command-line
arguments. Adapt the CLI tests so we no longer have to launch a
separate process.

Disable the busy handler for all concurrency tests; we have full
control over the order of the SQLite C API calls, so we can safely
do this.

The sqlite3 test suite now completes ~10 times faster than before.
@AlexWaygood AlexWaygood added the tests Tests in the Lib/test dir label Aug 27, 2023
erlend-aasland added a commit that referenced this issue Aug 28, 2023
Refactor the CLI so we can easily invoke it and mock command-line
arguments. Adapt the CLI tests so we no longer have to launch a
separate process.

Disable the busy handler for all concurrency tests; we have full
control over the order of the SQLite C API calls, so we can safely
do this.

The sqlite3 test suite now completes ~8 times faster than before.

Co-authored-by: Serhiy Storchaka <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Aug 28, 2023
Refactor the CLI so we can easily invoke it and mock command-line
arguments. Adapt the CLI tests so we no longer have to launch a
separate process.

Disable the busy handler for all concurrency tests; we have full
control over the order of the SQLite C API calls, so we can safely
do this.

The sqlite3 test suite now completes ~8 times faster than before.

(cherry picked from commit 0e8b3fc)

Co-authored-by: Erlend E. Aasland <[email protected]>
Co-authored-by: Serhiy Storchaka <[email protected]>
erlend-aasland added a commit to erlend-aasland/cpython that referenced this issue Aug 28, 2023
Disable the busy handler for all concurrency tests; we have full
control over the order of the SQLite C API calls, so we can safely
do this.

test_sqlite3.test_transactions now completes ~10 times faster than before.

Co-authored-by: Serhiy Storchaka <[email protected]>
erlend-aasland added a commit to erlend-aasland/cpython that referenced this issue Aug 28, 2023
Disable the busy handler for all concurrency tests; we have full
control over the order of the SQLite C API calls, so we can safely
do this.

test_sqlite3.test_transactions now completes ~10 times faster than before.

Co-authored-by: Serhiy Storchaka <[email protected]>
@erlend-aasland
Copy link
Contributor Author

Backports are queued up; marking this as resolved.

@github-project-automation github-project-automation bot moved this from In Progress to Done in sqlite3 issues Aug 28, 2023
erlend-aasland added a commit that referenced this issue Aug 28, 2023
Disable the busy handler for all concurrency tests; we have full
control over the order of the SQLite C API calls, so we can safely
do this.

test_sqlite3.test_transactions now completes ~10 times faster than before.

Co-authored-by: Serhiy Storchaka <[email protected]>
Yhg1s pushed a commit that referenced this issue Aug 28, 2023
gh-108550: Speed up sqlite3 tests (GH-108551)

Refactor the CLI so we can easily invoke it and mock command-line
arguments. Adapt the CLI tests so we no longer have to launch a
separate process.

Disable the busy handler for all concurrency tests; we have full
control over the order of the SQLite C API calls, so we can safely
do this.

The sqlite3 test suite now completes ~8 times faster than before.

(cherry picked from commit 0e8b3fc)

Co-authored-by: Erlend E. Aasland <[email protected]>
Co-authored-by: Serhiy Storchaka <[email protected]>
erlend-aasland added a commit to erlend-aasland/cpython that referenced this issue Aug 29, 2023
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Aug 29, 2023
Yhg1s pushed a commit that referenced this issue Aug 29, 2023
… (#108621)

gh-108550: Fix sqlite3 CLI regression from gh-108551 (GH-108618)
(cherry picked from commit c884784)

Co-authored-by: Erlend E. Aasland <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.11 only security fixes 3.12 only security fixes 3.13 bugs and security fixes tests Tests in the Lib/test dir type-feature A feature request or enhancement
Projects
Status: Done
Development

No branches or pull requests

2 participants