Add std/json lut_decimal_digits

name                                    old speed      new speed      delta

wuffs_json_decode_1k/clang5             1.13GB/s ± 0%  1.12GB/s ± 1%  -1.01%  (p=0.002 n=10+10)
wuffs_json_decode_21k_formatted/clang5   576MB/s ± 1%   595MB/s ± 1%  +3.29%  (p=0.000 n=10+10)
wuffs_json_decode_26k_compact/clang5     873MB/s ± 1%   907MB/s ± 1%  +3.81%  (p=0.000 n=10+10)
wuffs_json_decode_217k_stringy/clang5    727MB/s ± 0%   750MB/s ± 0%  +3.14%  (p=0.000 n=10+8)

wuffs_json_decode_1k/gcc9               1.10GB/s ± 1%  1.11GB/s ± 1%  +0.43%  (p=0.035 n=10+10)
wuffs_json_decode_21k_formatted/gcc9     628MB/s ± 0%   618MB/s ± 1%  -1.59%  (p=0.000 n=10+10)
wuffs_json_decode_26k_compact/gcc9       892MB/s ± 0%   888MB/s ± 1%  -0.43%  (p=0.023 n=10+10)
wuffs_json_decode_217k_stringy/gcc9      724MB/s ± 1%   733MB/s ± 1%  +1.28%  (p=0.000 n=10+10)
This commit is contained in:
Nigel Tao committed 2020-03-05 11:17:57 +11:00
1 parent 07110398f1
commit 771d4f9d98
3 files changed
+65 -2

No files matched your search

+22 -1
View File
@@ -19211,6 +19211,27 @@ static const uint8_t //
15, 15, 15, 15,
};
static const uint8_t //
wuffs_json__lut_decimal_digits[256] //
WUFFS_BASE__POTENTIALLY_UNUSED = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
static const uint8_t //
wuffs_json__lut_hexadecimal_digits[256] //
WUFFS_BASE__POTENTIALLY_UNUSED = {
@@ -20333,7 +20354,7 @@ wuffs_json__decoder__decode_digits(wuffs_json__decoder* self,
goto label__0__break;
}
v_c = wuffs_base__load_u8be__no_bounds_check(iop_a_src);
if ((v_c < 48) || (57 < v_c)) {
if (0 == wuffs_json__lut_decimal_digits[v_c]) {
goto label__0__break;
}
if (v_n >= 99) {
+42
View File
@@ -230,6 +230,48 @@ pri const lut_classes array[256] base.u8[..= 0x0F] = [
// 8 9 A B C D E F
]
pri const lut_decimal_digits array[256] base.u8 = [
// 0 1 2 3 4 5 6 7
// 8 9 A B C D E F
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x00 ..= 0x07.
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x08 ..= 0x0F.
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x10 ..= 0x17.
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x18 ..= 0x1F.
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x20 ..= 0x27.
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x28 ..= 0x2F.
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, // 0x30 ..= 0x37. '0'-'7'.
0x88, 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x38 ..= 0x3F. '8'-'9'.
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x40 ..= 0x47.
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x48 ..= 0x4F.
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x50 ..= 0x57.
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x58 ..= 0x5F.
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x60 ..= 0x67.
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x68 ..= 0x6F.
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x70 ..= 0x77.
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x78 ..= 0x7F.
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x80 ..= 0x87.
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x88 ..= 0x8F.
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x90 ..= 0x97.
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x98 ..= 0x9F.
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xA0 ..= 0xA7.
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xA8 ..= 0xAF.
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xB0 ..= 0xB7.
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xB8 ..= 0xBF.
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xC0 ..= 0xC7.
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xC8 ..= 0xCF.
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xD0 ..= 0xD7.
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xD8 ..= 0xDF.
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xE0 ..= 0xE7.
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xE8 ..= 0xEF.
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xF0 ..= 0xF7.
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xF8 ..= 0xFF.
// 0 1 2 3 4 5 6 7
// 8 9 A B C D E F
]
pri const lut_hexadecimal_digits array[256] base.u8 = [
// 0 1 2 3 4 5 6 7
// 8 9 A B C D E F
+1 -1
View File
@@ -974,7 +974,7 @@ pri func decoder.decode_digits!(src: base.io_reader, n: base.u32[..= 0xFF]) base
break
}
c = args.src.peek_u8()
if (c < 0x30) or (0x39 < c) {
if 0x00 == lut_decimal_digits[c] {
break
}
// Cap the maximum supported number length at an arbitrary value, 99.