GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-118761: Improve import time of `sqlite3` by Wulian233 · Pull Request #129118 · python/cpython

Conversation

@Wulian233

@Wulian233 Wulian233 commented Jan 21, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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 *'
  • Issue: Improve import time of various stdlib modules #118761

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Wulian233
Improve import time of sqlite3
2830c65
@Wulian233
Wulian233 requested review from berkerpeksag and erlend-aasland as code owners January 21, 2025 07:01
@bedevere-app bedevere-app Bot mentioned this pull request Jan 21, 2025
Improve import time of various stdlib modules #118761
Closed
@bedevere-app bedevere-app Bot added the awaiting review label Jan 21, 2025
@Wulian233
fix?
c6ca677
@erlend-aasland

erlend-aasland commented Jan 25, 2025

Copy link
Copy Markdown
Contributor

Please leave out all unrelated comment changes.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Wulian233 added 3 commits January 26, 2025 10:54
@Wulian233
comment
d727e36
@Wulian233
Merge branch 'sqlite' of https://github.com/Wulian233/cpython into sq…
1683261
…lite
@Wulian233
comment
d456d45
Wulian233
Wulian233 commented Jan 26, 2025
View reviewed changes
Comment thread Lib/sqlite3/__init__.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

AA-Turner
AA-Turner reviewed Jan 26, 2025
View reviewed changes
Comment thread Lib/sqlite3/__main__.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Wulian233 and others added 3 commits January 26, 2025 11:06
@Wulian233
Update __main__.py
14b8c29
@Wulian233
fix
1bdb28f
@erlend-aasland
Merge branch 'main' into sqlite
bec7330
erlend-aasland
erlend-aasland approved these changes Feb 2, 2025
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting review labels Feb 2, 2025
AA-Turner
AA-Turner approved these changes Feb 2, 2025
View reviewed changes

@AA-Turner AA-Turner left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this 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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Lib/sqlite3/dbapi2.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Lib/sqlite3/dbapi2.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Lib/sqlite3/dbapi2.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

erlend-aasland
erlend-aasland reviewed Feb 2, 2025
View reviewed changes
Comment thread Misc/NEWS.d/next/Library/2025-01-21-14-51-44.gh-issue-118761.Z0F-d5.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

@ghost

ghost commented Feb 3, 2025 •
edited by ghost
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.
CLA signed

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Wulian233
Wulian233 force-pushed the sqlite branch from 7057fff to bec7330 Compare February 3, 2025 01:44
@Wulian233
Add lazy import comment
e905f12
@Wulian233

Wulian233 commented Feb 3, 2025

Copy link
Copy Markdown
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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

AA-Turner
AA-Turner approved these changes Feb 7, 2025
View reviewed changes
@AA-Turner
Merge branch 'main' into sqlite
01ef116
@Wulian233 Wulian233 closed this Feb 11, 2025
@Wulian233
Wulian233 deleted the sqlite branch February 11, 2025 11:46
@Wulian233 Wulian233 mentioned this pull request Mar 27, 2025
gh-137855: Improve import time of sqlite3 #131796
Closed
@Wulian233

Wulian233 commented Mar 27, 2025

Copy link
Copy Markdown
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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@erlend-aasland erlend-aasland erlend-aasland approved these changes
@AA-Turner AA-Turner AA-Turner approved these changes
@berkerpeksag berkerpeksag Awaiting requested review from berkerpeksag

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

awaiting merge

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@Wulian233 @erlend-aasland @AA-Turner
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.