Mercurial > hg
comparison mercurial/cext/parsers.c @ 33925:2c37f9dabc32
encoding: add fast path of jsonescape() (issue5533)
This isn't highly optimized as it copies characters one by one, but seems
reasonably simple and not slow.
(with mercurial repo)
$ export HGRCPATH=/dev/null HGPLAIN=
$ hg log --time --config experimental.stabilization=all -Tjson > /dev/null
(original)
time: real 6.830 secs (user 6.740+0.000 sys 0.080+0.000)
time: real 6.690 secs (user 6.650+0.000 sys 0.040+0.000)
time: real 6.700 secs (user 6.640+0.000 sys 0.060+0.000)
(this patch)
time: real 5.630 secs (user 5.550+0.000 sys 0.070+0.000)
time: real 5.700 secs (user 5.650+0.000 sys 0.050+0.000)
time: real 5.690 secs (user 5.640+0.000 sys 0.050+0.000)
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 23 Apr 2017 14:47:52 +0900 |
parents | 4ba863c88135 |
children | f4433f2713d0 |
comparison
equal
deleted
inserted
replaced
33924:b9101467d88b | 33925:2c37f9dabc32 |
---|---|
700 {"asciiupper", asciiupper, METH_VARARGS, "uppercase an ASCII string\n"}, | 700 {"asciiupper", asciiupper, METH_VARARGS, "uppercase an ASCII string\n"}, |
701 {"dict_new_presized", dict_new_presized, METH_VARARGS, | 701 {"dict_new_presized", dict_new_presized, METH_VARARGS, |
702 "construct a dict with an expected size\n"}, | 702 "construct a dict with an expected size\n"}, |
703 {"make_file_foldmap", make_file_foldmap, METH_VARARGS, | 703 {"make_file_foldmap", make_file_foldmap, METH_VARARGS, |
704 "make file foldmap\n"}, | 704 "make file foldmap\n"}, |
705 {"jsonescapeu8fast", jsonescapeu8fast, METH_VARARGS, | |
706 "escape a UTF-8 byte string to JSON (fast path)\n"}, | |
705 {"encodedir", encodedir, METH_VARARGS, "encodedir a path\n"}, | 707 {"encodedir", encodedir, METH_VARARGS, "encodedir a path\n"}, |
706 {"pathencode", pathencode, METH_VARARGS, "fncache-encode a path\n"}, | 708 {"pathencode", pathencode, METH_VARARGS, "fncache-encode a path\n"}, |
707 {"lowerencode", lowerencode, METH_VARARGS, "lower-encode a path\n"}, | 709 {"lowerencode", lowerencode, METH_VARARGS, "lower-encode a path\n"}, |
708 {"fm1readmarkers", fm1readmarkers, METH_VARARGS, | 710 {"fm1readmarkers", fm1readmarkers, METH_VARARGS, |
709 "parse v1 obsolete markers\n"}, | 711 "parse v1 obsolete markers\n"}, |
712 | 714 |
713 void dirs_module_init(PyObject *mod); | 715 void dirs_module_init(PyObject *mod); |
714 void manifest_module_init(PyObject *mod); | 716 void manifest_module_init(PyObject *mod); |
715 void revlog_module_init(PyObject *mod); | 717 void revlog_module_init(PyObject *mod); |
716 | 718 |
717 static const int version = 1; | 719 static const int version = 2; |
718 | 720 |
719 static void module_init(PyObject *mod) | 721 static void module_init(PyObject *mod) |
720 { | 722 { |
721 PyModule_AddIntConstant(mod, "version", version); | 723 PyModule_AddIntConstant(mod, "version", version); |
722 | 724 |