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

gh-118761: Improve import time of sqlite3 #129118

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

Wulian233
Copy link
Contributor

@Wulian233 Wulian233 commented Jan 21, 2025

Improve import time of sqlite3 by around 2 times

Benchmark on Windows10, Python official 3.13.1

D:\Python313>hyperfine --warmup 8 "./python -c 'from sqlite3 import *'" "./python -c 'from sqlite3_new import *'"
Benchmark 1: ./python -c 'from sqlite3 import *'
  Time (mean ± σ):     135.0 µs ± 174.7 µs    [User: 1743.5 µs, System: 2196.8 µs]
  Range (min … max):     0.0 µs … 1225.1 µs    404 runs

Benchmark 2: ./python -c 'from sqlite3_new import *'
  Time (mean ± σ):     153.7 µs ± 196.7 µs    [User: 1868.9 µs, System: 1971.3 µs]
  Range (min … max):     0.0 µs … 2125.8 µs    409 runs

Summary
  ./python -c 'from sqlite3 import *' ran
    1.14 ± 2.07 times faster than ./python -c 'from sqlite3_new import *'

Outdated file comments have also been updated

@erlend-aasland
Copy link
Contributor

Please leave out all unrelated comment changes.

@@ -22,7 +22,7 @@

"""
The sqlite3 extension module provides a DB-API 2.0 (PEP 249) compliant
interface to the SQLite library, and requires SQLite 3.7.15 or newer.
interface to the SQLite library, and requires SQLite 3.15.2 or newer.
Copy link
Contributor Author

@Wulian233 Wulian233 Jan 26, 2025

Choose a reason for hiding this comment

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

@erlend-aasland Thanks review! I have removed unrelated comments, and correcting outdated information was retained. Changed in 3.13

https://github.com/python/cpython/blob/main/Doc%2Fusing%2Fconfigure.rst#L59-L59

Lib/sqlite3/__main__.py Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants