It's a real shame that there's no C implementation of encode_basestring - so the ensure_ascii=False codepath is so slow.
I don't really have enough context to fully understand it, but it looks to me like encode_basestring ought to be simpler to implement in C than py_encode_basestring_ascii, which of course already has a C implementation.
It's a real shame that there's no C implementation of
encode_basestring- so theensure_ascii=Falsecodepath is so slow.I don't really have enough context to fully understand it, but it looks to me like
encode_basestringought to be simpler to implement in C thanpy_encode_basestring_ascii, which of course already has a C implementation.