{"id":16376564,"url":"https://github.com/killercup/simd-utf8-check","last_synced_at":"2025-07-29T08:32:31.444Z","repository":{"id":66475218,"uuid":"133842202","full_name":"killercup/simd-utf8-check","owner":"killercup","description":null,"archived":false,"fork":false,"pushed_at":"2018-05-29T10:45:49.000Z","size":6633,"stargazers_count":13,"open_issues_count":5,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-04T12:11:26.758Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://killercup.github.io/simd-utf8-check/report/index.html","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/killercup.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-17T16:42:29.000Z","updated_at":"2020-08-27T13:59:26.000Z","dependencies_parsed_at":"2023-06-01T13:00:40.337Z","dependency_job_id":null,"html_url":"https://github.com/killercup/simd-utf8-check","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/killercup/simd-utf8-check","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/killercup%2Fsimd-utf8-check","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/killercup%2Fsimd-utf8-check/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/killercup%2Fsimd-utf8-check/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/killercup%2Fsimd-utf8-check/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/killercup","download_url":"https://codeload.github.com/killercup/simd-utf8-check/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/killercup%2Fsimd-utf8-check/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267653265,"owners_count":24122170,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-29T02:00:12.549Z","response_time":2574,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T03:25:08.754Z","updated_at":"2025-07-29T08:32:31.160Z","avatar_url":"https://github.com/killercup.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SIMD UTF8 Validation in Rust\n\nAfter reading the post [Validating UTF-8 strings using as little as 0.7 cycles per byte](https://lemire.me/blog/2018/05/16/validating-utf-8-strings-using-as-little-as-0-7-cycles-per-byte/),\nI was curious if this algorithm might be a good fit for Rust's standard library.\nBecause Rust's `String` type is guaranteed to be UTF8,\nyou'll need to either use `from_utf8` to convert an array of bytes to a `String`,\nor, if you trust the input, use the `unsafe fn from_utf8_unchecked`.\nThe faster `from_utf8` is, the more people can always use the safe version.\n\nOf course, I'm not the first person to think of this,\nand [this Rust PR](https://github.com/rust-lang/rust/pull/30740)\nalready contains a super fast implementation,\nalbeit one that that not use explicit SIMD intrinsics.\n\n## Benchmarks\n\n### Results\n\n```\n$ env RUSTFLAGS='-C target-cpu=native' cargo bench --quiet\n# ...\n$ open target/criterion/report/index.html\n```\n\n[You can also  find the rendered report here.](https://killercup.github.io/simd-utf8-check/report/index.html)\nThere are two runs, the first without and the second with the `target-cpu=native` flag.\nThis was benchmarked on a late 2016 MacBook Pro with an Intel i7 6700HQ CPU.\n\nCurrently, it looks like the current std impl is a bit faster for inputs that contain mostly ASCII,\nbut the SIMD version gives a significant speedup when dealing with multi-byte codepoints.\n\n### Data\n\n- jawik10: `curl -L http://dumps.wikimedia.org/archive/2006/2006-07/jawiki/20061016/jawiki-20061016-pages-articles.xml.bz2 | bunzip2 \u003e test/fixtures/jawik10`\n- enwiki8: From \u003chttp://mattmahoney.net/dc/textdata.html\u003e\n- `big10` is the dataset in \u003chttp://vaskir.blogspot.ru/2015/09/regular-expressions-rust-vs-f.html\u003e (see \u003chttps://drive.google.com/open?id=0B8HLQUKik9VtUWlOaHJPdG0xbnM\u003e)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkillercup%2Fsimd-utf8-check","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkillercup%2Fsimd-utf8-check","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkillercup%2Fsimd-utf8-check/lists"}