Skip to content

Conversation

@ChALkeR
Copy link
Contributor

@ChALkeR ChALkeR commented Oct 14, 2025

Depends on:

Only the last commit is new here: 6c73324

base32 (encode) 32 B scure x 1,808,318 ops/sec @ 553ns/op ± 3.32% (375ns..5ms)
base32 (decode) 32 B scure x 1,828,153 ops/sec @ 547ns/op ± 4.21% (375ns..6ms)
base32 (encode) 64 B scure x 1,140,250 ops/sec @ 877ns/op ± 3.18% (708ns..5ms)
base32 (decode) 64 B scure x 1,030,927 ops/sec @ 970ns/op ± 3.73% (791ns..7ms)
base32 (encode) 1 KB scure x 112,145 ops/sec @ 8μs/op ± 1.88% (8μs..7ms)
base32 (decode) 1 KB scure x 88,849 ops/sec @ 11μs/op
base32 (encode) 8 KB scure x 14,765 ops/sec @ 67μs/op
base32 (decode) 8 KB scure x 11,357 ops/sec @ 88μs/op
base32 (encode) 1 MB scure x 114 ops/sec @ 8ms/op
base32 (decode) 1 MB scure x 88 ops/sec @ 11ms/op

@ChALkeR ChALkeR changed the title perf: use TextDecoder for building strings perf: use TextDecoder for building strings when available Oct 14, 2025
@ChALkeR ChALkeR mentioned this pull request Oct 14, 2025
index.ts Outdated

// Their length (number of non-default args) is 0 per spec, which native engines follow
// Slow text-encoding polyfill that we want to avoid has length = 2
const nativeDecoder = globalThis.TextDecoder && globalThis.TextDecoder.length === 0 ? new TextDecoder() : null;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first check will throw syntax error and stop parsing in environments without globalThis.

The better, more explicit way:

https://github.com/paulmillr/noble-hashes/blob/d30e0707258f4cf0d4fb5dd6062436f8c1e997eb/src/utils.ts#L329

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pushed a fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants