[pypy-dev] CFFI speed results

Elefterios Stamatogiannakis estama at gmail.com
Wed Dec 26 21:45:37 CET 2012


On 26/12/2012 6:19 μμ, Maciej Fijalkowski wrote:
> On Wed, Dec 26, 2012 at 5:24 PM, Elefterios Stamatogiannakis
> <estama at gmail.com> wrote:
>>
>> Thank you for looking into this part of pypy's performance. Whenever
>> something reaches a testable state we would be glad to test/benchmark it.
>>
>> On another front. We tried using SQLite's UTF-16 API to avoid doing the
>> conversion to UTF-8 whenever we returned a string from pypy to SQLite. We
>> used function "sqlite3_result_text16":
>>
>> http://www.sqlite.org/c3ref/result_blob.html
>>
>> defining it in CFFI as:
>>
>> void sqlite3_result_text16(sqlite3_context*, wchar_t*, int, void(*)(void*));
>>
>> The problem was that giving directly a pypy string to above function (using
>> wchar_t type), only the first character of the string was passed to SQLite.
>>
>> The only way to successfully pass a string to SQLite was by explicitly
>> converting/encoding it to utf-16.
>>
>> So the question i have is, does pypy keep its strings internally to utf-16?
>>
>> Thanks again (and a happy new year) to all.
>>
>> l.
>
> Are you talking about strings or unicodes? that is, type str or unicode?
>

For unicode only. For regular type == str we use SQLite's 
sqlite3_result_text without doing any conversion/encoding at all.

l.


More information about the pypy-dev mailing list