New submission from Erlend E. Aasland <erlend.aasl...@innova.no>:

The third argument to sqlite3_result_text() is the length of the string passed 
as the second argument. Currently, we pass -1, so SQLite has to invoke strlen() 
to compute the length of the passed string. Suggesting to use 
PyUnicode_AsUTF8AndSize() iso. PyUnicode_AsUTF8() and pass the string size to 
avoid the superfluous strlen().

See also:
- https://sqlite.org/c3ref/result_blob.html

----------
assignee: erlendaasland
components: Extension Modules
messages: 398865
nosy: erlendaasland
priority: normal
severity: normal
status: open
title: [sqlite3] Micro-optimisation: pass string size to sqlite3_result_text()
type: enhancement
versions: Python 3.11

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue44822>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to