Skip to content

Commit 815cb6c

Browse files
committed
perf: use our impl for single-bytes that are slow natively
1 parent 018968c commit 815cb6c

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

single-byte.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ const { TextDecoder } = globalThis
66

77
let windows1252works
88

9+
// prettier-ignore
10+
const skipNative = new Set([
11+
'iso-8859-16', // iso-8859-16 is somehow broken in WebKit, at least on CI
12+
'iso-8859-6', 'iso-8859-8', 'iso-8859-8-i', // slow in all 3 engines
13+
])
14+
915
function shouldUseNative(enc) {
1016
// https://issues.chromium.org/issues/468458388
1117
// Also might be incorrectly imlemented on platforms as Latin1 (e.g. in Node.js) or regress
@@ -24,8 +30,7 @@ function shouldUseNative(enc) {
2430
return windows1252works
2531
}
2632

27-
// iso-8859-16 is somehow broken in WebKit, at least on CI
28-
return enc !== 'iso-8859-16'
33+
return !skipNative.has(enc)
2934
}
3035

3136
export function createSinglebyteDecoder(encoding, loose = false) {

0 commit comments

Comments
 (0)