diff options
author | rover <pathfinder2013@126.com> | 2017-01-01 21:14:50 +0800 |
---|---|---|
committer | rover <pathfinder2013@126.com> | 2017-01-01 21:15:50 +0800 |
commit | 67056529281efabb41050b9840ce5649a7e6e7a3 (patch) | |
tree | ca3490b301f47a5ff6d9e634f66ed52be7a0ce01 | |
parent | 61d4ca214fef227aeb69ff02c2eb39f7a9e1e89e (diff) | |
download | rneovim-67056529281efabb41050b9840ce5649a7e6e7a3.tar.gz rneovim-67056529281efabb41050b9840ce5649a7e6e7a3.tar.bz2 rneovim-67056529281efabb41050b9840ce5649a7e6e7a3.zip |
vim-patch:7.4.2019
Problem: When ignoring case utf_fold() may consume a lot of time.
Solution: Optimize for ASCII.
https://github.com/vim/vim/commit/c4a927ca8dc383190d5df2cacd3f966698b6190c
-rw-r--r-- | src/nvim/mbyte.c | 4 | ||||
-rw-r--r-- | src/nvim/version.c | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c index 2ecd86974e..e8b1131767 100644 --- a/src/nvim/mbyte.c +++ b/src/nvim/mbyte.c @@ -1315,6 +1315,10 @@ static int utf_convert(int a, const convertStruct *const table, size_t n_items) */ int utf_fold(int a) { + if (a < 0x80) { + // be fast for ASCII + return a >= 0x41 && a <= 0x5a ? a + 32 : a; + } return utf_convert(a, foldCase, ARRAY_SIZE(foldCase)); } diff --git a/src/nvim/version.c b/src/nvim/version.c index be17b6775a..9ad40cddd2 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -421,7 +421,7 @@ static int included_patches[] = { // 2022, // 2021, // 2020 NA - // 2019, + 2019, // 2018, // 2017, // 2016 NA |