Skip to content

[sqlite3] speed up cursor.execute*() #90792

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 Feb 4, 2022 · 2 comments
Closed

[sqlite3] speed up cursor.execute*() #90792

erlend-aasland opened this issue Feb 4, 2022 · 2 comments
Labels
3.11 only security fixes extension-modules C modules in the Modules dir topic-sqlite3

Comments

@erlend-aasland
Copy link
Contributor

BPO 46634
Nosy @erlend-aasland
PRs
  • bpo-46634: Inline calls to Connection.cursor() in sqlite3 #31127
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2022-02-17.08:26:39.839>
    created_at = <Date 2022-02-04.10:38:53.668>
    labels = ['extension-modules', '3.11']
    title = '[sqlite3]\xc2\xa0speed up cursor.execute*()'
    updated_at = <Date 2022-02-17.08:26:39.838>
    user = 'https://github.com/erlend-aasland'

    bugs.python.org fields:

    activity = <Date 2022-02-17.08:26:39.838>
    actor = 'erlendaasland'
    assignee = 'none'
    closed = True
    closed_date = <Date 2022-02-17.08:26:39.839>
    closer = 'erlendaasland'
    components = ['Extension Modules']
    creation = <Date 2022-02-04.10:38:53.668>
    creator = 'erlendaasland'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 46634
    keywords = ['patch']
    message_count = 2.0
    messages = ['412503', '413390']
    nosy_count = 1.0
    nosy_names = ['erlendaasland']
    pr_nums = ['31127']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue46634'
    versions = ['Python 3.11']

    @erlend-aasland
    Copy link
    Contributor Author

    pysqlite_connection_execute_impl() and friends (executemany, executescript) goes all the way through the Call API just to call pysqlite_connection_cursor_impl. We can same a lot of calls by calling the cursor _impl function directly; after all, it does live in the same file scope as the callers.

    A quick bench (sqlitesynth) shows a small speedup:

    Mean +- std dev: [main] 9.55 us +- 0.25 us -> [patched] 9.32 us +- 0.23 us: 1.02x faster
    

    (Side effect: will get rid of _Py_IDENTIFIER(cursor) in sqlite3)

    @erlend-aasland erlend-aasland added 3.11 only security fixes extension-modules C modules in the Modules dir labels Feb 4, 2022
    @erlend-aasland
    Copy link
    Contributor Author

    The change proposed in #75310 was included in #75532. Closing this.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.11 only security fixes extension-modules C modules in the Modules dir topic-sqlite3
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant