Skip to content

Commit 9563972

Browse files
committed
perf: tiny improvement in Hermes toHex
1 parent 26990fd commit 9563972

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

fallback/hex.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,17 @@ function toHexPartAddition(arr, start, end) {
3535
function toHexPartTemplates(arr, start, end) {
3636
let o = ''
3737
let i = start
38-
const last7 = end - 7
3938
const ha = hexArray
4039
// Unrolled loop is faster
41-
while (i < last7) {
42-
const a = arr[i++]
43-
const b = arr[i++]
44-
const c = arr[i++]
45-
const d = arr[i++]
46-
const e = arr[i++]
47-
const f = arr[i++]
48-
const g = arr[i++]
49-
const h = arr[i++]
40+
for (const last7 = end - 7; i < last7; i += 8) {
41+
const a = arr[i]
42+
const b = arr[i + 1]
43+
const c = arr[i + 2]
44+
const d = arr[i + 3]
45+
const e = arr[i + 4]
46+
const f = arr[i + 5]
47+
const g = arr[i + 6]
48+
const h = arr[i + 7]
5049
o += `${ha[a]}${ha[b]}${ha[c]}${ha[d]}${ha[e]}${ha[f]}${ha[g]}${ha[h]}`
5150
}
5251

0 commit comments

Comments
 (0)