[issue44079] [sqlite3] optimisation: remove statement weak ref list from connection object

2021-05-08 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
keywords: +patch
pull_requests: +24651
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/25998

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44079] [sqlite3] optimisation: remove statement weak ref list from connection object

2021-05-08 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

Berker/Serhiy, weak ref. list question:
Could also the pysqlite_Statement.in_weakreflist member go? Seems to be ok:

$ git diff --shortstat
 3 files changed, 13 insertions(+), 72 deletions(-)
$ ./python.exe -m test -R : test_sqlite
0:00:00 load avg: 0.83 Run tests sequentially
0:00:00 load avg: 0.83 [1/1] test_sqlite
beginning 9 repetitions
123456789
.

== Tests result: SUCCESS ==

1 test OK.

Total duration: 5.7 sec
Tests result: SUCCESS

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44079] [sqlite3] optimisation: remove statement weak ref list from connection object

2021-05-08 Thread Erlend E. Aasland


New submission from Erlend E. Aasland :

Today, the sqlite3 extension module keeps two[1] lists of statements:

 1. The statement cache[2], stored in pysqlite_Connection.statement_cache
 2. A weak ref. list (hard coded limited to 200 statements in 
_pysqlite_drop_unused_statement_references()), stored in 
pysqlite_Connection.statements

AFAICS, there's no benefit in keeping both. Suggesting to remove the latter.

Pro's:
- less lines of code to maintain
- clearer code
- one less data member in pysqlite_Connection
- improved test coverage (there are currently no coverage for 
_pysqlite_drop_unused_statement_references()[3])

Con's:
- the current code works / "code churn"


$ git diff --shortstat 
 1 file changed, 13 insertions(+), 60 deletions(-)


[1] Actually, there's three lists: SQLite also keeps a list, available using 
sqlite3_stmt_next()
[2] See bpo-42862 for suggested improvements to the current cache implementation
[3] See bpo-43553 for improving the code coverage of the sqlite3 extension 
module

--
assignee: erlendaasland
components: Extension Modules
messages: 393282
nosy: berker.peksag, erlendaasland, serhiy.storchaka
priority: normal
severity: normal
status: open
title: [sqlite3] optimisation: remove statement weak ref list from connection 
object
type: resource usage
versions: Python 3.11

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com