Serhiy Storchaka added the comment: Victor's patch harvested most fruits, but there is a place for further optimization.
Benchmark results for new patch: Py3.2 Py3.3 Py3.6 Py3.6+patch 451 (-47%) 77 (+209%) 140 (+70%) 238 decode unicode-escape 'A'*10000 269 (-14%) 161 (+44%) 187 (+24%) 232 decode unicode-escape '\x80'*10000 453 (-48%) 85 (+178%) 181 (+30%) 236 decode unicode-escape '\x80'+'A'*9999 295 (-4%) 185 (+54%) 229 (+24%) 284 decode unicode-escape '\u0100'*10000 452 (-47%) 75 (+221%) 213 (+13%) 241 decode unicode-escape '\u0100'+'A'*9999 275 (-11%) 149 (+64%) 187 (+30%) 244 decode unicode-escape '\u0100'+'\x80'*9999 297 (-4%) 185 (+54%) 230 (+23%) 284 decode unicode-escape '\u8000'*10000 452 (-47%) 75 (+221%) 213 (+13%) 241 decode unicode-escape '\u8000'+'A'*9999 275 (-11%) 149 (+64%) 187 (+30%) 244 decode unicode-escape '\u8000'+'\x80'*9999 295 (-3%) 185 (+54%) 230 (+24%) 285 decode unicode-escape '\u8000'+'\u0100'*9999 318 (-29%) 203 (+11%) 220 (+2%) 225 decode unicode-escape '\U00010000'*10000 452 (-51%) 72 (+207%) 163 (+36%) 221 decode unicode-escape '\U00010000'+'A'*9999 275 (-31%) 128 (+49%) 160 (+19%) 191 decode unicode-escape '\U00010000'+'\x80'*9999 295 (-36%) 164 (+16%) 201 (-5%) 190 decode unicode-escape '\U00010000'+'\u0100'*9999 297 (-36%) 166 (+14%) 199 (-5%) 190 decode unicode-escape '\U00010000'+'\u8000'*9999 559 (-62%) 88 (+143%) 194 (+10%) 214 decode raw-unicode-escape 'A'*10000 555 (-62%) 88 (+142%) 195 (+9%) 213 decode raw-unicode-escape '\x80'*10000 559 (-62%) 88 (+142%) 195 (+9%) 213 decode raw-unicode-escape '\x80'+'A'*9999 265 (+29%) 133 (+156%) 212 (+61%) 341 decode raw-unicode-escape '\u0100'*10000 563 (-54%) 77 (+235%) 195 (+32%) 258 decode raw-unicode-escape '\u0100'+'A'*9999 559 (-54%) 77 (+234%) 194 (+32%) 257 decode raw-unicode-escape '\u0100'+'\x80'*9999 269 (+27%) 138 (+147%) 208 (+64%) 341 decode raw-unicode-escape '\u8000'*10000 562 (-54%) 77 (+235%) 193 (+34%) 258 decode raw-unicode-escape '\u8000'+'A'*9999 559 (-54%) 77 (+234%) 194 (+32%) 257 decode raw-unicode-escape '\u8000'+'\x80'*9999 265 (+29%) 138 (+147%) 208 (+64%) 341 decode raw-unicode-escape '\u8000'+'\u0100'*9999 281 (-13%) 152 (+61%) 228 (+7%) 244 decode raw-unicode-escape '\U00010000'*10000 562 (-65%) 74 (+164%) 200 (-2%) 195 decode raw-unicode-escape '\U00010000'+'A'*9999 557 (-65%) 74 (+162%) 200 (-3%) 194 decode raw-unicode-escape '\U00010000'+'\x80'*9999 265 (-2%) 122 (+114%) 184 (+42%) 261 decode raw-unicode-escape '\U00010000'+'\u0100'*9999 269 (-3%) 122 (+113%) 185 (+41%) 260 decode raw-unicode-escape '\U00010000'+'\u8000'*9999 195 (+136%) 109 (+323%) 258 (+79%) 461 encode unicode-escape 'A'*10000 673 (-23%) 522 (-1%) 254 (+103%) 516 encode unicode-escape '\x80'*10000 197 (+134%) 132 (+248%) 247 (+86%) 460 encode unicode-escape '\x80'+'A'*9999 869 (-22%) 627 (+9%) 333 (+105%) 682 encode unicode-escape '\u0100'*10000 197 (-19%) 124 (+28%) 158 (+1%) 159 encode unicode-escape '\u0100'+'A'*9999 669 (-35%) 493 (-12%) 236 (+83%) 432 encode unicode-escape '\u0100'+'\x80'*9999 866 (-20%) 628 (+10%) 333 (+108%) 692 encode unicode-escape '\u8000'*10000 197 (-19%) 125 (+27%) 158 (+1%) 159 encode unicode-escape '\u8000'+'A'*9999 669 (-35%) 492 (-12%) 236 (+83%) 433 encode unicode-escape '\u8000'+'\x80'*9999 869 (-20%) 627 (+11%) 324 (+114%) 694 encode unicode-escape '\u8000'+'\u0100'*9999 870 (-1%) 897 (-4%) 501 (+72%) 861 encode unicode-escape '\U00010000'*10000 197 (+20%) 139 (+70%) 234 (+1%) 236 encode unicode-escape '\U00010000'+'A'*9999 668 (-27%) 533 (-9%) 249 (+96%) 487 encode unicode-escape '\U00010000'+'\x80'*9999 869 (-12%) 646 (+18%) 344 (+122%) 764 encode unicode-escape '\U00010000'+'\u0100'*9999 864 (-12%) 643 (+19%) 344 (+122%) 762 encode unicode-escape '\U00010000'+'\u8000'*9999 391 (+1310%) 333 (+1556%) 575 (+859%) 5514 encode raw-unicode-escape 'A'*10000 391 (+1229%) 334 (+1456%) 576 (+802%) 5198 encode raw-unicode-escape '\x80'*10000 391 (+1402%) 335 (+1653%) 579 (+914%) 5873 encode raw-unicode-escape '\x80'+'A'*9999 869 (-25%) 687 (-5%) 356 (+83%) 652 encode raw-unicode-escape '\u0100'*10000 391 (+46%) 158 (+260%) 214 (+166%) 569 encode raw-unicode-escape '\u0100'+'A'*9999 391 (+46%) 158 (+260%) 214 (+166%) 569 encode raw-unicode-escape '\u0100'+'\x80'*9999 873 (-25%) 682 (-4%) 356 (+83%) 652 encode raw-unicode-escape '\u8000'*10000 391 (+46%) 158 (+260%) 214 (+166%) 569 encode raw-unicode-escape '\u8000'+'A'*9999 391 (+46%) 157 (+262%) 214 (+166%) 569 encode raw-unicode-escape '\u8000'+'\x80'*9999 869 (-25%) 688 (-5%) 345 (+90%) 656 encode raw-unicode-escape '\u8000'+'\u0100'*9999 917 (+4%) 859 (+11%) 532 (+79%) 952 encode raw-unicode-escape '\U00010000'*10000 392 (-15%) 182 (+84%) 260 (+28%) 334 encode raw-unicode-escape '\U00010000'+'A'*9999 392 (-15%) 182 (+83%) 260 (+28%) 333 encode raw-unicode-escape '\U00010000'+'\x80'*9999 870 (-15%) 672 (+10%) 355 (+108%) 738 encode raw-unicode-escape '\U00010000'+'\u0100'*9999 871 (-16%) 672 (+9%) 355 (+106%) 730 encode raw-unicode-escape '\U00010000'+'\u8000'*9999 ---------- versions: +Python 3.6 -Python 3.4 Added file: http://bugs.python.org/file43475/faster_unicode_escape_4.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue16334> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com