mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-18 02:22:30 +00:00
Make improvements
- wcsstr() is now linearly complex - strstr16() is now linearly complex - strstr() is now vectorized on aarch64 (10x) - strstr() now uses KMP on pathological cases - memmem() is now vectorized on aarch64 (10x) - memmem() now uses KMP on pathological cases - Disable shared_ptr::owner_before until fixed - Make iswlower(), iswupper() consistent with glibc - Remove figure space from iswspace() implementation - Include line and paragraph separator in iswcntrl() - Use Musl wcwidth(), iswalpha(), iswpunct(), towlower(), towupper()
This commit is contained in:
parent
e1528a71e2
commit
7c83f4abc8
67 changed files with 5602 additions and 5165 deletions
|
@ -16,9 +16,11 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/str/strwidth.h"
|
||||
#include "libc/str/unicode.h"
|
||||
#include "libc/testlib/benchmark.h"
|
||||
#include "libc/testlib/ezbench.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
|
||||
|
@ -28,6 +30,7 @@ TEST(wcwidth, test) {
|
|||
ASSERT_EQ(-1, wcwidth(-7));
|
||||
ASSERT_EQ(1, wcwidth(0x10FFFD));
|
||||
ASSERT_EQ(-1, wcwidth(0x10FFFD + 1));
|
||||
ASSERT_EQ(2, wcwidth(L'😀'));
|
||||
}
|
||||
|
||||
TEST(strwidth, testCjkWidesAndCombiningLowLines_withThompsonPikeEncoding) {
|
||||
|
@ -74,6 +77,12 @@ TEST(strwidth, testTextDelimitingControlCodes_dontHaveSubstance) {
|
|||
EXPECT_EQ(0, strwidth("\1", 0));
|
||||
}
|
||||
|
||||
#define WCWIDTH(x) __expropriate(wcwidth(__veil("r", x)))
|
||||
|
||||
BENCH(wcwidth, bench) {
|
||||
EZBENCH2("wcwidth", donothing, __expropriate(wcwidth(__veil("r", u'→'))));
|
||||
BENCHMARK(1000, 1, WCWIDTH(u'a'));
|
||||
BENCHMARK(1000, 1, WCWIDTH(u'a'));
|
||||
BENCHMARK(1000, 1, WCWIDTH(u'→'));
|
||||
BENCHMARK(1000, 1, WCWIDTH(L'😀'));
|
||||
BENCHMARK(1000, 1, WCWIDTH(0));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue