Mercurial > public > mercurial-scm > hg
diff mercurial/cext/parsers.c @ 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 | b90e8da190da |
line wrap: on
line diff
--- a/mercurial/cext/parsers.c Sun Apr 23 14:47:52 2017 +0900 +++ b/mercurial/cext/parsers.c Sun Apr 23 12:59:42 2017 +0900 @@ -696,6 +696,7 @@ {"parse_manifest", parse_manifest, METH_VARARGS, "parse a manifest\n"}, {"parse_dirstate", parse_dirstate, METH_VARARGS, "parse a dirstate\n"}, {"parse_index2", parse_index2, METH_VARARGS, "parse a revlog index\n"}, + {"isasciistr", isasciistr, METH_VARARGS, "check if an ASCII string\n"}, {"asciilower", asciilower, METH_VARARGS, "lowercase an ASCII string\n"}, {"asciiupper", asciiupper, METH_VARARGS, "uppercase an ASCII string\n"}, {"dict_new_presized", dict_new_presized, METH_VARARGS, @@ -716,7 +717,7 @@ void manifest_module_init(PyObject *mod); void revlog_module_init(PyObject *mod); -static const int version = 2; +static const int version = 3; static void module_init(PyObject *mod) {