Files
scylladb/utils
Yibo Cai (Arm Technology China) 422987ab04 utils: add fast ascii string validation
Validate ascii string by ORing all bytes and check if 7-th bit is 0.
Compared with original std::any_of(), which checks ascii string byte
by byte, this new approach validates input in 8 bytes and two
independent streams. Performance is much higher for normal cases,
though slightly slower when string is very short. See table below.

Speed(MB/s) of ascii string validation
+---------------+-------------+---------+
| String length | std::any_of | u64 x 2 |
+---------------+-------------+---------+
| 9 bytes       | 1691        | 1635    |
+---------------+-------------+---------+
| 31 bytes      | 2923        | 3181    |
+---------------+-------------+---------+
| 129 bytes     | 3377        | 15110   |
+---------------+-------------+---------+
| 1039 bytes    | 3357        | 31815   |
+---------------+-------------+---------+
| 16385 bytes   | 3448        | 47983   |
+---------------+-------------+---------+
| 1048576 bytes | 3394        | 31391   |
+---------------+-------------+---------+

Signed-off-by: Yibo Cai <yibo.cai@arm.com>
Message-Id: <1544669646-31881-1-git-send-email-yibo.cai@arm.com>
2018-12-24 09:58:08 +02:00
..
2018-11-21 00:01:44 +02:00
2018-11-21 00:01:44 +02:00
2018-12-03 14:36:08 +01:00
2018-05-30 14:41:40 +02:00
2018-12-03 14:36:08 +01:00
2018-11-21 00:01:44 +02:00
2017-04-17 23:03:15 +03:00
2017-05-17 12:30:03 +03:00
2018-11-21 00:01:44 +02:00
2018-11-21 00:01:44 +02:00
2018-11-21 00:01:44 +02:00
2018-11-21 00:01:44 +02:00
2016-09-28 17:34:16 +03:00
2017-09-18 12:44:05 +02:00
2018-11-21 00:01:44 +02:00
2018-11-21 00:01:44 +02:00
2018-12-06 14:21:04 +00:00
2018-12-05 21:51:01 +02:00
2018-12-05 21:51:01 +02:00
2018-11-21 00:01:44 +02:00
2018-11-21 00:01:44 +02:00