Hello,

First of all, directly supporting UTF8 in CFFI has been discussed before. I'm bringing the same subject again because now PyPy aims to convert to using UTF8 internally by default. So the question is, will CFFI take advantage of that?

Right now cffi_backend's "b_string" works with ASCII and widechar strings as input. This means that for UTF-8 input we need to first parse (via ffi.string) the char* as str (1st copy), and then convert it to UTF-8 (doing a 2nd copy?).

Wouldn't it be faster to have a ffi.stringUTF8 for the case where we know the input is in UTF8?

Ideally we could also have a ffi.stringUTF8const, which knowing that the char* is const (won't be changed by the C side), won't do a copy at all?

Kind regards,

l.

_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
https://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to