Skip to content

gh-118761: Improve import time of sqlite3 #129118

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
wants to merge 10 commits into from
Closed

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 *'

@erlend-aasland
Copy link
Contributor

Please leave out all unrelated comment changes.

Copy link
Member

@AA-Turner AA-Turner left a comment

Choose a reason for hiding this comment

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

It may be worth adding comments to indicate why we do the lazy imports -- but optional.

A

@ghost
Copy link

ghost commented Feb 3, 2025

All commit authors signed the Contributor License Agreement.
CLA signed

@Wulian233
Copy link
Contributor Author

All commit authors signed the Contributor License Agreement. CLA signed

All the suggestion comments have been added, and this one appears because I have logged in to the wrong git account

@Wulian233
Copy link
Contributor Author

@erlend-aasland I just realized today that I accidentally deleted an unmerged branch last month, which resulted in closing this PR. My apologies for the oversight. I've now recreated the pull request - the content remains exactly the same as before. Appreciate your understanding

#131796

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