Skip to content

Commit ecdee8d

Browse files
authored
Upgrade deps (#113)
1 parent 301fe41 commit ecdee8d

5 files changed

Lines changed: 399 additions & 1130 deletions

File tree

‎benchmarks/base64.bench.ts‎

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { bench, describe } from 'vitest';
1+
import { describe, test } from 'vitest';
22

33
type Uint8ArrayWithBase64 = typeof Uint8Array & {
44
fromBase64?: (str: string) => Uint8Array;
@@ -79,22 +79,28 @@ for (const payload of payloads) {
7979
describe('decode base64 for basic-auth payloads', () => {
8080
for (const payload of payloads) {
8181
describe(payload.name, () => {
82-
bench.skipIf(!hasUint8ArrayFromBase64)(
82+
test.skipIf(!hasUint8ArrayFromBase64)(
8383
'Uint8Array.fromBase64 + TextDecoder',
84-
() => {
85-
decodeBase64WithUint8Array(payload.encoded);
84+
async ({ bench }) => {
85+
await bench('Uint8Array.fromBase64 + TextDecoder', () => {
86+
decodeBase64WithUint8Array(payload.encoded);
87+
}).run();
8688
},
8789
);
8890

89-
bench.skipIf(!hasNodeBuffer)(
91+
test.skipIf(!hasNodeBuffer)(
9092
'Buffer.from(base64).toString(utf-8)',
91-
() => {
92-
decodeBase64WithNodeBuffer(payload.encoded);
93+
async ({ bench }) => {
94+
await bench('Buffer.from(base64).toString(utf-8)', () => {
95+
decodeBase64WithNodeBuffer(payload.encoded);
96+
}).run();
9397
},
9498
);
9599

96-
bench('atob + Uint8Array.from + TextDecoder', () => {
97-
decodeBase64WithAtob(payload.encoded);
100+
test('atob + Uint8Array.from + TextDecoder', async ({ bench }) => {
101+
await bench('atob + Uint8Array.from + TextDecoder', () => {
102+
decodeBase64WithAtob(payload.encoded);
103+
}).run();
98104
});
99105
});
100106
}

0 commit comments

Comments
 (0)