# std.unicode.utf8ValidateSlice: optimize implementation \(\#17329\) · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/d68f39b5412e0aeb59d71c9f676221212261dc8c)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: d68f39b5412e0aeb59d71c9f676221212261dc8c

Requested commit: d68f39b5412e0aeb59d71c9f676221212261dc8c

Commit: d68f39b5412e0aeb59d71c9f676221212261dc8c

Tree: 7d92d2bf3634ffdc0ac3e3a461d38b2a18bb0b2b

Author: Karl Seguin

Committer: GitHub

## Message

```
std.unicode.utf8ValidateSlice: optimize implementation (#17329)

Originally inspired by Go's `utf8.Valid` function. Includes some test cases from Go's test suite.

Further optimized to be faster in all tested cases (short/long ascii/UTF8), in all release modes.

Takes advantage of SIMD for the ASCII fast path.
```

## Parents

- [5a4a5875dc49dd4e027b17b96dd1348822806e58](https://git.cafe/gitcafe/zig/commit/5a4a5875dc49dd4e027b17b96dd1348822806e58?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/d68f39b5412e0aeb59d71c9f676221212261dc8c?format=markdown)
