[Python-Dev] The future of the wchar_t cache

Serhiy Storchaka storchaka at gmail.com
Mon Oct 22 09:34:29 EDT 2018

20.10.18 16:01, Stefan Behnel пише:
> But regarding the use under Windows, I
> wonder if there's interest in keeping it as a special Windows-only feature,
> e.g. to speed up the data exchange with the Win32 APIs. I guess it would
> have to provide a visible (performance?) advantage to justify such special
> casing over the code removal.

This is an interesting question, and we should found the answer right 
now. Should PyUnicode_AsWideChar() and PyUnicode_AsWideCharString() 
continue to attach the wchar_t representation to the unicode object on 
Windows? The cost is higher memory consumption and slower first time 
call. The benefit is faster following calls for the same object. 
Although they still need to copy the content, so the time is still O(N), 
just with smaller constant multiplier.

More information about the Python-Dev mailing list