a collection of lightweight TypeScript packages for AT Protocol, the protocol powering Bluesky
atproto bluesky typescript npm

chore(cbor): make large bench work

mary.my.id 137d7882 0034e4fa

verified
Changed files
+20 -10
packages
+8 -4
packages/utilities/cbor/lib/large.bench.ts
··· 1 1 import { bench, do_not_optimize, run, summary } from 'mitata'; 2 2 3 3 import * as ipld from '@ipld/dag-cbor'; 4 - import * as cborx from 'cbor-x/index-no-eval'; // doesn't do new Function nor native acceleration 4 + import * as cborx from 'cbor-x'; 5 5 import * as atcute from './index.js'; 6 6 7 7 const OBJECT = await fetch( 8 - 'https://tangled.org/@mary.my.id/atcute/raw/trunk/lexdocs/bluesky/app/bsky/actor/defs.json', 8 + 'https://tangled.org/@mary.my.id/atcute/raw/trunk/packages/definitions/ozone/lexicons/tools/ozone/moderation/defs.json', 9 9 ).then((r) => r.json()); 10 10 11 + if (OBJECT.id !== 'tools.ozone.moderation.defs') { 12 + throw new Error(`invalid`); 13 + } 14 + 11 15 const BUFFER = atcute.encode(OBJECT); 12 16 13 - const getBuffer = () => new Uint8Array([...BUFFER]); 14 - const getObject = () => ({ ...OBJECT }); 17 + const getBuffer = () => structuredClone(BUFFER); 18 + const getObject = () => structuredClone({ ...OBJECT }); 15 19 16 20 summary(() => { 17 21 bench('cbor-x encode', function* () {
+1
packages/utilities/cbor/package.json
··· 31 31 }, 32 32 "devDependencies": { 33 33 "@ipld/dag-cbor": "^9.2.5", 34 + "@types/node": "^22.19.1", 34 35 "@vitest/coverage-v8": "^4.0.14", 35 36 "cbor-x": "^1.6.0", 36 37 "vitest": "^4.0.14"
+1 -1
packages/utilities/cbor/tsconfig.json
··· 1 1 { 2 2 "compilerOptions": { 3 - "types": [], 3 + "types": ["node"], 4 4 "outDir": "dist/", 5 5 "esModuleInterop": true, 6 6 "skipLibCheck": true,
+10 -5
pnpm-lock.yaml
··· 813 813 '@ipld/dag-cbor': 814 814 specifier: ^9.2.5 815 815 version: 9.2.5 816 + '@types/node': 817 + specifier: ^22.19.1 818 + version: 22.19.1 816 819 '@vitest/coverage-v8': 817 820 specifier: ^4.0.14 818 - version: 4.0.14(@vitest/browser@4.0.14(vite@7.2.4(@types/node@24.10.1)(jiti@2.6.1)(tsx@4.20.6)(yaml@2.8.0))(vitest@4.0.14))(vitest@4.0.14) 821 + version: 4.0.14(@vitest/browser@4.0.14(vite@7.2.4(@types/node@22.19.1)(jiti@2.6.1)(tsx@4.20.6)(yaml@2.8.0))(vitest@4.0.14))(vitest@4.0.14) 819 822 cbor-x: 820 823 specifier: ^1.6.0 821 824 version: 1.6.0 822 825 vitest: 823 826 specifier: ^4.0.14 824 - version: 4.0.14(@types/node@24.10.1)(@vitest/browser-playwright@4.0.14)(jiti@2.6.1)(tsx@4.20.6)(yaml@2.8.0) 827 + version: 4.0.14(@types/node@22.19.1)(@vitest/browser-playwright@4.0.14)(jiti@2.6.1)(tsx@4.20.6)(yaml@2.8.0) 825 828 826 829 packages/utilities/cid: 827 830 dependencies: ··· 5738 5741 5739 5742 '@types/bn.js@5.2.0': 5740 5743 dependencies: 5741 - '@types/node': 24.10.1 5744 + '@types/node': 22.19.1 5742 5745 5743 5746 '@types/bun@1.3.3': 5744 5747 dependencies: ··· 5770 5773 '@types/node@24.10.1': 5771 5774 dependencies: 5772 5775 undici-types: 7.16.0 5776 + optional: true 5773 5777 5774 5778 '@types/ws@8.18.1': 5775 5779 dependencies: ··· 6059 6063 6060 6064 bun-types@1.3.3: 6061 6065 dependencies: 6062 - '@types/node': 24.10.1 6066 + '@types/node': 22.19.1 6063 6067 6064 6068 bytes@3.1.2: {} 6065 6069 ··· 7435 7439 7436 7440 undici-types@6.21.0: {} 7437 7441 7438 - undici-types@7.16.0: {} 7442 + undici-types@7.16.0: 7443 + optional: true 7439 7444 7440 7445 undici@6.22.0: {} 7441 7446