Mercurial > public > mercurial-scm > hg
comparison mercurial/encoding.py @ 33926:f4433f2713d0
encoding: add function to test if a str consists of ASCII characters
Most strings are ASCII. Let's optimize for it.
Using uint64_t is slightly faster than uint32_t on 64bit system, but there
isn't huge difference.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 23 Apr 2017 12:59:42 +0900 |
parents | 2c37f9dabc32 |
children | 853574db5b12 |
comparison
equal
deleted
inserted
replaced
33925:2c37f9dabc32 | 33926:f4433f2713d0 |
---|---|
22 charencode as charencodepure, | 22 charencode as charencodepure, |
23 ) | 23 ) |
24 | 24 |
25 charencode = policy.importmod(r'charencode') | 25 charencode = policy.importmod(r'charencode') |
26 | 26 |
27 isasciistr = charencode.isasciistr | |
27 asciilower = charencode.asciilower | 28 asciilower = charencode.asciilower |
28 asciiupper = charencode.asciiupper | 29 asciiupper = charencode.asciiupper |
29 _jsonescapeu8fast = charencode.jsonescapeu8fast | 30 _jsonescapeu8fast = charencode.jsonescapeu8fast |
30 | 31 |
31 _sysstr = pycompat.sysstr | 32 _sysstr = pycompat.sysstr |