From cfcefc9cc55171bc6b6d4d10c9c1f3154aa04bf4 Mon Sep 17 00:00:00 2001 From: ssalbdivad Date: Thu, 18 Jul 2024 03:18:37 -0400 Subject: [PATCH 1/4] perf(common): cleanup some inferred types, add vanilla template benchmark --- .gitignore | 1 + package.json | 2 + packages/common/src/getContract.ts | 28 +- pnpm-lock.yaml | 322 ++++++++++++++++++ templates/vanilla/packages/client/bench.ts | 32 ++ .../vanilla/packages/client/package.json | 3 + .../vanilla/packages/client/tsconfig.json | 5 +- 7 files changed, 377 insertions(+), 16 deletions(-) create mode 100644 templates/vanilla/packages/client/bench.ts diff --git a/.gitignore b/.gitignore index 7334e874cd..232e9bb4d7 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,4 @@ test-data/world-logs-bulk-*.json test-data/world-logs-query.json .attest +.tstrace \ No newline at end of file diff --git a/package.json b/package.json index df2157f242..4235b8fbe1 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ "package.json": "pnpm sort-package-json" }, "devDependencies": { + "@ark/attest": "0.9.2", "@changesets/cli": "^2.26.1", "@types/node": "^18.15.11", "@typescript-eslint/eslint-plugin": "7.1.1", @@ -51,6 +52,7 @@ "prettier": "3.2.5", "prettier-plugin-solidity": "1.3.1", "rimraf": "^3.0.2", + "tsx": "4.16.2", "turbo": "^1.9.3", "typescript": "5.4.2" }, diff --git a/packages/common/src/getContract.ts b/packages/common/src/getContract.ts index c8e53057d3..57a37f09aa 100644 --- a/packages/common/src/getContract.ts +++ b/packages/common/src/getContract.ts @@ -79,16 +79,16 @@ export function getContract< TPublicClient, TWalletClient >): GetContractReturnType { - const contract = viem_getContract({ + const contract: GetContractReturnType & { + write: unknown; + } = viem_getContract({ abi, address, client: { public: publicClient, wallet: walletClient, }, - }) as unknown as GetContractReturnType & { - write: unknown; - }; + }) as never; if (contract.write) { // Replace write calls with our own. Implemented ~the same as viem, but adds better handling of nonces (via queue + retries). @@ -104,21 +104,21 @@ export function getContract< ] ) => { const { args, options } = getFunctionParameters(parameters); - const request = { + const request: WriteContractParameters< + TAbi, + ContractFunctionName, + ContractFunctionArgs, + TChain, + TAccount + > = { abi, address, functionName, args, ...options, onWrite, - } as unknown as WriteContractParameters< - TAbi, - ContractFunctionName, - ContractFunctionArgs, - TChain, - TAccount - >; - const result = writeContract(walletClient, request, { publicClient }); + } as never; + const result = writeContract(walletClient, request, { publicClient }) as never; const id = `${walletClient.chain.id}:${walletClient.account.address}:${nextWriteId++}`; onWrite?.({ @@ -134,5 +134,5 @@ export function getContract< ); } - return contract as unknown as GetContractReturnType; + return contract; } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6733c1e6c4..a10c40bf2f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,6 +8,9 @@ importers: .: devDependencies: + '@ark/attest': + specifier: 0.9.2 + version: 0.9.2(typescript@5.4.2) '@changesets/cli': specifier: ^2.26.1 version: 2.26.1 @@ -50,6 +53,9 @@ importers: rimraf: specifier: ^3.0.2 version: 3.0.2 + tsx: + specifier: 4.16.2 + version: 4.16.2 turbo: specifier: ^1.9.3 version: 1.9.3 @@ -1178,6 +1184,21 @@ packages: resolution: {integrity: sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg==} engines: {node: '>=6.0.0'} + '@ark/attest@0.9.2': + resolution: {integrity: sha512-AgwTHTmRMKiEWFeXIHtNb87KISPwACn+kUrAxlqyRx+0/opXA1qnEn/hKCyB61zWPfcur4dB0GUnx+ILDCl5Dg==} + hasBin: true + peerDependencies: + typescript: '*' + + '@ark/fs@0.1.0': + resolution: {integrity: sha512-A7zoIqcO8dPKbzYruYuCro1J4Ai/20rwlIJv2ExbKOBl/XowczKnNV8bh+6azOkkieeZJdrnSXSfNklVHf7zoA==} + + '@ark/schema@0.2.0': + resolution: {integrity: sha512-IkNWCSHdjaoemMXpps4uFHEAQzwJPbTAS8K2vcQpk90sa+eNBuPSVyB/81/Qyl1VYW0iX3ceGC5NL/OznQv1jg==} + + '@ark/util@0.1.0': + resolution: {integrity: sha512-qCLYICQoCy3kEKDVwirQp8qvxhY7NJd8BhhoHaj1l3wCFAk9NUbcDsxAkPStZEMdPI/d7NcbGJe8SWZuRG2twQ==} + '@arktype/attest@0.7.5': resolution: {integrity: sha512-ZOF9uqLbvoVO6RHhlByJEBBj5qhWLpaCK/wWa5guD1OQR1/a7JZ9jCrDAcaASt6tYBA3dGhDerXhc7FcDWlRQw==} hasBin: true @@ -1561,6 +1582,12 @@ packages: '@esbuild-kit/esm-loader@2.5.5': resolution: {integrity: sha512-Qwfvj/qoPbClxCRNuac1Du01r9gvNOT+pMYtJDapfB1eoGN1YlJ1BixLyL9WVENRx5RXgNLdfYdx/CuswlGhMw==} + '@esbuild/aix-ppc64@0.21.5': + resolution: {integrity: sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==} + engines: {node: '>=12'} + cpu: [ppc64] + os: [aix] + '@esbuild/android-arm64@0.17.15': resolution: {integrity: sha512-0kOB6Y7Br3KDVgHeg8PRcvfLkq+AccreK///B4Z6fNZGr/tNHX0z2VywCc7PTeWp+bPvjA5WMvNXltHw5QjAIA==} engines: {node: '>=12'} @@ -1573,6 +1600,12 @@ packages: cpu: [arm64] os: [android] + '@esbuild/android-arm64@0.21.5': + resolution: {integrity: sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==} + engines: {node: '>=12'} + cpu: [arm64] + os: [android] + '@esbuild/android-arm@0.17.15': resolution: {integrity: sha512-sRSOVlLawAktpMvDyJIkdLI/c/kdRTOqo8t6ImVxg8yT7LQDUYV5Rp2FKeEosLr6ZCja9UjYAzyRSxGteSJPYg==} engines: {node: '>=12'} @@ -1585,6 +1618,12 @@ packages: cpu: [arm] os: [android] + '@esbuild/android-arm@0.21.5': + resolution: {integrity: sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==} + engines: {node: '>=12'} + cpu: [arm] + os: [android] + '@esbuild/android-x64@0.17.15': resolution: {integrity: sha512-MzDqnNajQZ63YkaUWVl9uuhcWyEyh69HGpMIrf+acR4otMkfLJ4sUCxqwbCyPGicE9dVlrysI3lMcDBjGiBBcQ==} engines: {node: '>=12'} @@ -1597,6 +1636,12 @@ packages: cpu: [x64] os: [android] + '@esbuild/android-x64@0.21.5': + resolution: {integrity: sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==} + engines: {node: '>=12'} + cpu: [x64] + os: [android] + '@esbuild/darwin-arm64@0.17.15': resolution: {integrity: sha512-7siLjBc88Z4+6qkMDxPT2juf2e8SJxmsbNVKFY2ifWCDT72v5YJz9arlvBw5oB4W/e61H1+HDB/jnu8nNg0rLA==} engines: {node: '>=12'} @@ -1609,6 +1654,12 @@ packages: cpu: [arm64] os: [darwin] + '@esbuild/darwin-arm64@0.21.5': + resolution: {integrity: sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==} + engines: {node: '>=12'} + cpu: [arm64] + os: [darwin] + '@esbuild/darwin-x64@0.17.15': resolution: {integrity: sha512-NbImBas2rXwYI52BOKTW342Tm3LTeVlaOQ4QPZ7XuWNKiO226DisFk/RyPk3T0CKZkKMuU69yOvlapJEmax7cg==} engines: {node: '>=12'} @@ -1621,6 +1672,12 @@ packages: cpu: [x64] os: [darwin] + '@esbuild/darwin-x64@0.21.5': + resolution: {integrity: sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==} + engines: {node: '>=12'} + cpu: [x64] + os: [darwin] + '@esbuild/freebsd-arm64@0.17.15': resolution: {integrity: sha512-Xk9xMDjBVG6CfgoqlVczHAdJnCs0/oeFOspFap5NkYAmRCT2qTn1vJWA2f419iMtsHSLm+O8B6SLV/HlY5cYKg==} engines: {node: '>=12'} @@ -1633,6 +1690,12 @@ packages: cpu: [arm64] os: [freebsd] + '@esbuild/freebsd-arm64@0.21.5': + resolution: {integrity: sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==} + engines: {node: '>=12'} + cpu: [arm64] + os: [freebsd] + '@esbuild/freebsd-x64@0.17.15': resolution: {integrity: sha512-3TWAnnEOdclvb2pnfsTWtdwthPfOz7qAfcwDLcfZyGJwm1SRZIMOeB5FODVhnM93mFSPsHB9b/PmxNNbSnd0RQ==} engines: {node: '>=12'} @@ -1645,6 +1708,12 @@ packages: cpu: [x64] os: [freebsd] + '@esbuild/freebsd-x64@0.21.5': + resolution: {integrity: sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [freebsd] + '@esbuild/linux-arm64@0.17.15': resolution: {integrity: sha512-T0MVnYw9KT6b83/SqyznTs/3Jg2ODWrZfNccg11XjDehIved2oQfrX/wVuev9N936BpMRaTR9I1J0tdGgUgpJA==} engines: {node: '>=12'} @@ -1657,6 +1726,12 @@ packages: cpu: [arm64] os: [linux] + '@esbuild/linux-arm64@0.21.5': + resolution: {integrity: sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==} + engines: {node: '>=12'} + cpu: [arm64] + os: [linux] + '@esbuild/linux-arm@0.17.15': resolution: {integrity: sha512-MLTgiXWEMAMr8nmS9Gigx43zPRmEfeBfGCwxFQEMgJ5MC53QKajaclW6XDPjwJvhbebv+RzK05TQjvH3/aM4Xw==} engines: {node: '>=12'} @@ -1669,6 +1744,12 @@ packages: cpu: [arm] os: [linux] + '@esbuild/linux-arm@0.21.5': + resolution: {integrity: sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==} + engines: {node: '>=12'} + cpu: [arm] + os: [linux] + '@esbuild/linux-ia32@0.17.15': resolution: {integrity: sha512-wp02sHs015T23zsQtU4Cj57WiteiuASHlD7rXjKUyAGYzlOKDAjqK6bk5dMi2QEl/KVOcsjwL36kD+WW7vJt8Q==} engines: {node: '>=12'} @@ -1681,6 +1762,12 @@ packages: cpu: [ia32] os: [linux] + '@esbuild/linux-ia32@0.21.5': + resolution: {integrity: sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==} + engines: {node: '>=12'} + cpu: [ia32] + os: [linux] + '@esbuild/linux-loong64@0.17.15': resolution: {integrity: sha512-k7FsUJjGGSxwnBmMh8d7IbObWu+sF/qbwc+xKZkBe/lTAF16RqxRCnNHA7QTd3oS2AfGBAnHlXL67shV5bBThQ==} engines: {node: '>=12'} @@ -1693,6 +1780,12 @@ packages: cpu: [loong64] os: [linux] + '@esbuild/linux-loong64@0.21.5': + resolution: {integrity: sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==} + engines: {node: '>=12'} + cpu: [loong64] + os: [linux] + '@esbuild/linux-mips64el@0.17.15': resolution: {integrity: sha512-ZLWk6czDdog+Q9kE/Jfbilu24vEe/iW/Sj2d8EVsmiixQ1rM2RKH2n36qfxK4e8tVcaXkvuV3mU5zTZviE+NVQ==} engines: {node: '>=12'} @@ -1705,6 +1798,12 @@ packages: cpu: [mips64el] os: [linux] + '@esbuild/linux-mips64el@0.21.5': + resolution: {integrity: sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==} + engines: {node: '>=12'} + cpu: [mips64el] + os: [linux] + '@esbuild/linux-ppc64@0.17.15': resolution: {integrity: sha512-mY6dPkIRAiFHRsGfOYZC8Q9rmr8vOBZBme0/j15zFUKM99d4ILY4WpOC7i/LqoY+RE7KaMaSfvY8CqjJtuO4xg==} engines: {node: '>=12'} @@ -1717,6 +1816,12 @@ packages: cpu: [ppc64] os: [linux] + '@esbuild/linux-ppc64@0.21.5': + resolution: {integrity: sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==} + engines: {node: '>=12'} + cpu: [ppc64] + os: [linux] + '@esbuild/linux-riscv64@0.17.15': resolution: {integrity: sha512-EcyUtxffdDtWjjwIH8sKzpDRLcVtqANooMNASO59y+xmqqRYBBM7xVLQhqF7nksIbm2yHABptoioS9RAbVMWVA==} engines: {node: '>=12'} @@ -1729,6 +1834,12 @@ packages: cpu: [riscv64] os: [linux] + '@esbuild/linux-riscv64@0.21.5': + resolution: {integrity: sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==} + engines: {node: '>=12'} + cpu: [riscv64] + os: [linux] + '@esbuild/linux-s390x@0.17.15': resolution: {integrity: sha512-BuS6Jx/ezxFuHxgsfvz7T4g4YlVrmCmg7UAwboeyNNg0OzNzKsIZXpr3Sb/ZREDXWgt48RO4UQRDBxJN3B9Rbg==} engines: {node: '>=12'} @@ -1741,6 +1852,12 @@ packages: cpu: [s390x] os: [linux] + '@esbuild/linux-s390x@0.21.5': + resolution: {integrity: sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==} + engines: {node: '>=12'} + cpu: [s390x] + os: [linux] + '@esbuild/linux-x64@0.17.15': resolution: {integrity: sha512-JsdS0EgEViwuKsw5tiJQo9UdQdUJYuB+Mf6HxtJSPN35vez1hlrNb1KajvKWF5Sa35j17+rW1ECEO9iNrIXbNg==} engines: {node: '>=12'} @@ -1753,6 +1870,12 @@ packages: cpu: [x64] os: [linux] + '@esbuild/linux-x64@0.21.5': + resolution: {integrity: sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [linux] + '@esbuild/netbsd-x64@0.17.15': resolution: {integrity: sha512-R6fKjtUysYGym6uXf6qyNephVUQAGtf3n2RCsOST/neIwPqRWcnc3ogcielOd6pT+J0RDR1RGcy0ZY7d3uHVLA==} engines: {node: '>=12'} @@ -1765,6 +1888,12 @@ packages: cpu: [x64] os: [netbsd] + '@esbuild/netbsd-x64@0.21.5': + resolution: {integrity: sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==} + engines: {node: '>=12'} + cpu: [x64] + os: [netbsd] + '@esbuild/openbsd-x64@0.17.15': resolution: {integrity: sha512-mVD4PGc26b8PI60QaPUltYKeSX0wxuy0AltC+WCTFwvKCq2+OgLP4+fFd+hZXzO2xW1HPKcytZBdjqL6FQFa7w==} engines: {node: '>=12'} @@ -1777,6 +1906,12 @@ packages: cpu: [x64] os: [openbsd] + '@esbuild/openbsd-x64@0.21.5': + resolution: {integrity: sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==} + engines: {node: '>=12'} + cpu: [x64] + os: [openbsd] + '@esbuild/sunos-x64@0.17.15': resolution: {integrity: sha512-U6tYPovOkw3459t2CBwGcFYfFRjivcJJc1WC8Q3funIwX8x4fP+R6xL/QuTPNGOblbq/EUDxj9GU+dWKX0oWlQ==} engines: {node: '>=12'} @@ -1789,6 +1924,12 @@ packages: cpu: [x64] os: [sunos] + '@esbuild/sunos-x64@0.21.5': + resolution: {integrity: sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==} + engines: {node: '>=12'} + cpu: [x64] + os: [sunos] + '@esbuild/win32-arm64@0.17.15': resolution: {integrity: sha512-W+Z5F++wgKAleDABemiyXVnzXgvRFs+GVKThSI+mGgleLWluv0D7Diz4oQpgdpNzh4i2nNDzQtWbjJiqutRp6Q==} engines: {node: '>=12'} @@ -1801,6 +1942,12 @@ packages: cpu: [arm64] os: [win32] + '@esbuild/win32-arm64@0.21.5': + resolution: {integrity: sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==} + engines: {node: '>=12'} + cpu: [arm64] + os: [win32] + '@esbuild/win32-ia32@0.17.15': resolution: {integrity: sha512-Muz/+uGgheShKGqSVS1KsHtCyEzcdOn/W/Xbh6H91Etm+wiIfwZaBn1W58MeGtfI8WA961YMHFYTthBdQs4t+w==} engines: {node: '>=12'} @@ -1813,6 +1960,12 @@ packages: cpu: [ia32] os: [win32] + '@esbuild/win32-ia32@0.21.5': + resolution: {integrity: sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==} + engines: {node: '>=12'} + cpu: [ia32] + os: [win32] + '@esbuild/win32-x64@0.17.15': resolution: {integrity: sha512-DjDa9ywLUUmjhV2Y9wUTIF+1XsmuFGvZoCmOWkli1XcNAh5t25cc7fgsCx4Zi/Uurep3TTLyDiKATgGEg61pkA==} engines: {node: '>=12'} @@ -1825,6 +1978,12 @@ packages: cpu: [x64] os: [win32] + '@esbuild/win32-x64@0.21.5': + resolution: {integrity: sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==} + engines: {node: '>=12'} + cpu: [x64] + os: [win32] + '@eslint-community/eslint-utils@4.4.0': resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -2570,6 +2729,11 @@ packages: '@typescript/vfs@1.5.0': resolution: {integrity: sha512-AJS307bPgbsZZ9ggCT3wwpg3VbTKMFNHfaY/uF0ahSkYYrPF2dSSKDNIDIQAHm9qJqbLvCsSJH7yN4Vs/CsMMg==} + '@typescript/vfs@1.5.3': + resolution: {integrity: sha512-OSZ/o3wwD5VPZVdGGsXWk7sRGRtwrGnqA4zwmb33FTs7Wxmad0QTkQCbaNyqWA8hL09TCwAthdp8yjFA5G1lvw==} + peerDependencies: + typescript: '*' + '@ungap/structured-clone@1.2.0': resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} @@ -2781,6 +2945,9 @@ packages: arktype@1.0.29-alpha: resolution: {integrity: sha512-glMLgVhIQRSkR3tymiS+POAcWVJH09sfrgic0jHnyFL8BlhHAJZX2BzdImU9zYr1y9NBqy+U93ZNrRTHXsKRDw==} + arktype@2.0.0-beta.0: + resolution: {integrity: sha512-fE3ssMiXjr/bLqFPzlDhRlXngdyHQreu7p7i8+dtcY1CA+f8WrVUcue6JxywhnqEJXPG4HOcIwQcC+q4VfeUMQ==} + arktype@2.0.0-dev.11: resolution: {integrity: sha512-k+WVQoHsHsTyTiVQkO201mxLQxyXHmy3buJW8TXLOkr4X2yOUCp0K1SBscuG9OEJoc8MjpvoIharjPHEkFI7kg==} @@ -3549,6 +3716,11 @@ packages: engines: {node: '>=12'} hasBin: true + esbuild@0.21.5: + resolution: {integrity: sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==} + engines: {node: '>=12'} + hasBin: true + escalade@3.1.1: resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==} engines: {node: '>=6'} @@ -3952,6 +4124,9 @@ packages: get-tsconfig@4.5.0: resolution: {integrity: sha512-MjhiaIWCJ1sAU4pIQ5i5OfOuHHxVo1oYeNsWTON7jxYkod8pHocXeh+SSbmu5OZZZK73B6cbJ2XADzXehLyovQ==} + get-tsconfig@4.7.5: + resolution: {integrity: sha512-ZCuZCnlqNzjb4QprAzXKdpp/gh6KTxSJuw3IBsPnV/7fV4NxC9ckB+vPTt8w7fJA0TaSD7c55BR47JD6MEDyDw==} + gitconfig@2.0.8: resolution: {integrity: sha512-qOB1QswIHFNKAOPN0pEu7U1iyajLBv3Tz5X630UlkAtKM904I4dO7XIjH84wmR2SUVAgaVR99UC9U4ABJujAJQ==} engines: {node: '>=6', npm: '>=3'} @@ -5634,6 +5809,9 @@ packages: resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==} engines: {node: '>=8'} + resolve-pkg-maps@1.0.0: + resolution: {integrity: sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==} + resolve.exports@2.0.2: resolution: {integrity: sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==} engines: {node: '>=10'} @@ -6269,6 +6447,11 @@ packages: resolution: {integrity: sha512-q93WgS3lBdHlPgS0h1i+87Pt6n9K/qULIMNYZo07nSeu2z5QE2CellcAZfofVXBo2tQg9av2ZcRMQ2S2i5oadQ==} hasBin: true + tsx@4.16.2: + resolution: {integrity: sha512-C1uWweJDgdtX2x600HjaFaucXTilT7tgUZHbOE4+ypskZ1OP8CRCSDkCxG6Vya9EwaFIVagWwpaVAn5wzypaqQ==} + engines: {node: '>=18.0.0'} + hasBin: true + tty-table@4.2.1: resolution: {integrity: sha512-xz0uKo+KakCQ+Dxj1D/tKn2FSyreSYWzdkL/BYhgN6oMW808g8QRMuh1atAV9fjTPbWBjfbkKQpI/5rEcnAc7g==} engines: {node: '>=8.0.0'} @@ -6744,6 +6927,25 @@ snapshots: '@jridgewell/gen-mapping': 0.3.3 '@jridgewell/trace-mapping': 0.3.18 + '@ark/attest@0.9.2(typescript@5.4.2)': + dependencies: + '@ark/fs': 0.1.0 + '@ark/util': 0.1.0 + '@typescript/analyze-trace': 0.10.1 + '@typescript/vfs': 1.5.3(typescript@5.4.2) + arktype: 2.0.0-beta.0 + typescript: 5.4.2 + transitivePeerDependencies: + - supports-color + + '@ark/fs@0.1.0': {} + + '@ark/schema@0.2.0': + dependencies: + '@ark/util': 0.1.0 + + '@ark/util@0.1.0': {} + '@arktype/attest@0.7.5(typescript@5.4.2)': dependencies: '@arktype/fs': 0.0.19 @@ -7534,138 +7736,207 @@ snapshots: '@esbuild-kit/core-utils': 3.1.0 get-tsconfig: 4.5.0 + '@esbuild/aix-ppc64@0.21.5': + optional: true + '@esbuild/android-arm64@0.17.15': optional: true '@esbuild/android-arm64@0.17.17': optional: true + '@esbuild/android-arm64@0.21.5': + optional: true + '@esbuild/android-arm@0.17.15': optional: true '@esbuild/android-arm@0.17.17': optional: true + '@esbuild/android-arm@0.21.5': + optional: true + '@esbuild/android-x64@0.17.15': optional: true '@esbuild/android-x64@0.17.17': optional: true + '@esbuild/android-x64@0.21.5': + optional: true + '@esbuild/darwin-arm64@0.17.15': optional: true '@esbuild/darwin-arm64@0.17.17': optional: true + '@esbuild/darwin-arm64@0.21.5': + optional: true + '@esbuild/darwin-x64@0.17.15': optional: true '@esbuild/darwin-x64@0.17.17': optional: true + '@esbuild/darwin-x64@0.21.5': + optional: true + '@esbuild/freebsd-arm64@0.17.15': optional: true '@esbuild/freebsd-arm64@0.17.17': optional: true + '@esbuild/freebsd-arm64@0.21.5': + optional: true + '@esbuild/freebsd-x64@0.17.15': optional: true '@esbuild/freebsd-x64@0.17.17': optional: true + '@esbuild/freebsd-x64@0.21.5': + optional: true + '@esbuild/linux-arm64@0.17.15': optional: true '@esbuild/linux-arm64@0.17.17': optional: true + '@esbuild/linux-arm64@0.21.5': + optional: true + '@esbuild/linux-arm@0.17.15': optional: true '@esbuild/linux-arm@0.17.17': optional: true + '@esbuild/linux-arm@0.21.5': + optional: true + '@esbuild/linux-ia32@0.17.15': optional: true '@esbuild/linux-ia32@0.17.17': optional: true + '@esbuild/linux-ia32@0.21.5': + optional: true + '@esbuild/linux-loong64@0.17.15': optional: true '@esbuild/linux-loong64@0.17.17': optional: true + '@esbuild/linux-loong64@0.21.5': + optional: true + '@esbuild/linux-mips64el@0.17.15': optional: true '@esbuild/linux-mips64el@0.17.17': optional: true + '@esbuild/linux-mips64el@0.21.5': + optional: true + '@esbuild/linux-ppc64@0.17.15': optional: true '@esbuild/linux-ppc64@0.17.17': optional: true + '@esbuild/linux-ppc64@0.21.5': + optional: true + '@esbuild/linux-riscv64@0.17.15': optional: true '@esbuild/linux-riscv64@0.17.17': optional: true + '@esbuild/linux-riscv64@0.21.5': + optional: true + '@esbuild/linux-s390x@0.17.15': optional: true '@esbuild/linux-s390x@0.17.17': optional: true + '@esbuild/linux-s390x@0.21.5': + optional: true + '@esbuild/linux-x64@0.17.15': optional: true '@esbuild/linux-x64@0.17.17': optional: true + '@esbuild/linux-x64@0.21.5': + optional: true + '@esbuild/netbsd-x64@0.17.15': optional: true '@esbuild/netbsd-x64@0.17.17': optional: true + '@esbuild/netbsd-x64@0.21.5': + optional: true + '@esbuild/openbsd-x64@0.17.15': optional: true '@esbuild/openbsd-x64@0.17.17': optional: true + '@esbuild/openbsd-x64@0.21.5': + optional: true + '@esbuild/sunos-x64@0.17.15': optional: true '@esbuild/sunos-x64@0.17.17': optional: true + '@esbuild/sunos-x64@0.21.5': + optional: true + '@esbuild/win32-arm64@0.17.15': optional: true '@esbuild/win32-arm64@0.17.17': optional: true + '@esbuild/win32-arm64@0.21.5': + optional: true + '@esbuild/win32-ia32@0.17.15': optional: true '@esbuild/win32-ia32@0.17.17': optional: true + '@esbuild/win32-ia32@0.21.5': + optional: true + '@esbuild/win32-x64@0.17.15': optional: true '@esbuild/win32-x64@0.17.17': optional: true + '@esbuild/win32-x64@0.21.5': + optional: true + '@eslint-community/eslint-utils@4.4.0(eslint@8.57.0)': dependencies: eslint: 8.57.0 @@ -8702,6 +8973,13 @@ snapshots: transitivePeerDependencies: - supports-color + '@typescript/vfs@1.5.3(typescript@5.4.2)': + dependencies: + debug: 4.3.4 + typescript: 5.4.2 + transitivePeerDependencies: + - supports-color + '@ungap/structured-clone@1.2.0': {} '@viem/anvil@0.0.7(debug@4.3.4)': @@ -8896,6 +9174,11 @@ snapshots: arktype@1.0.29-alpha: {} + arktype@2.0.0-beta.0: + dependencies: + '@ark/schema': 0.2.0 + '@ark/util': 0.1.0 + arktype@2.0.0-dev.11: dependencies: '@arktype/schema': 0.1.2 @@ -9749,6 +10032,32 @@ snapshots: '@esbuild/win32-ia32': 0.17.17 '@esbuild/win32-x64': 0.17.17 + esbuild@0.21.5: + optionalDependencies: + '@esbuild/aix-ppc64': 0.21.5 + '@esbuild/android-arm': 0.21.5 + '@esbuild/android-arm64': 0.21.5 + '@esbuild/android-x64': 0.21.5 + '@esbuild/darwin-arm64': 0.21.5 + '@esbuild/darwin-x64': 0.21.5 + '@esbuild/freebsd-arm64': 0.21.5 + '@esbuild/freebsd-x64': 0.21.5 + '@esbuild/linux-arm': 0.21.5 + '@esbuild/linux-arm64': 0.21.5 + '@esbuild/linux-ia32': 0.21.5 + '@esbuild/linux-loong64': 0.21.5 + '@esbuild/linux-mips64el': 0.21.5 + '@esbuild/linux-ppc64': 0.21.5 + '@esbuild/linux-riscv64': 0.21.5 + '@esbuild/linux-s390x': 0.21.5 + '@esbuild/linux-x64': 0.21.5 + '@esbuild/netbsd-x64': 0.21.5 + '@esbuild/openbsd-x64': 0.21.5 + '@esbuild/sunos-x64': 0.21.5 + '@esbuild/win32-arm64': 0.21.5 + '@esbuild/win32-ia32': 0.21.5 + '@esbuild/win32-x64': 0.21.5 + escalade@3.1.1: {} escalade@3.1.2: {} @@ -10270,6 +10579,10 @@ snapshots: get-tsconfig@4.5.0: {} + get-tsconfig@4.7.5: + dependencies: + resolve-pkg-maps: 1.0.0 + gitconfig@2.0.8: dependencies: argx: 3.0.2 @@ -12192,6 +12505,8 @@ snapshots: resolve-from@5.0.0: {} + resolve-pkg-maps@1.0.0: {} + resolve.exports@2.0.2: {} resolve@1.22.2: @@ -12863,6 +13178,13 @@ snapshots: optionalDependencies: fsevents: 2.3.3 + tsx@4.16.2: + dependencies: + esbuild: 0.21.5 + get-tsconfig: 4.7.5 + optionalDependencies: + fsevents: 2.3.3 + tty-table@4.2.1: dependencies: chalk: 4.1.2 diff --git a/templates/vanilla/packages/client/bench.ts b/templates/vanilla/packages/client/bench.ts new file mode 100644 index 0000000000..3686710921 --- /dev/null +++ b/templates/vanilla/packages/client/bench.ts @@ -0,0 +1,32 @@ +import { bench } from "@ark/attest"; +import { syncToRecs } from "@latticexyz/store-sync/recs"; +import { Hex, type PublicClient } from "viem"; +import { defineWorld } from "@latticexyz/world"; +import { createWorld } from "@latticexyz/recs"; + +bench("SyncToRecs", async () => { + const world = createWorld(); + const config = defineWorld({ + namespace: "demo", + tables: { + Position: { + schema: { + entity: "address", + x: "int32", + y: "int32", + }, + key: ["entity"], + }, + }, + }); + + const t = await syncToRecs({ + world, + config, + address: {} as Hex, + publicClient: {} as PublicClient, + startBlock: 0n, + }); + + return t; +}).types([21758, "instantiations"]); diff --git a/templates/vanilla/packages/client/package.json b/templates/vanilla/packages/client/package.json index 58f660b0f5..179e36f557 100644 --- a/templates/vanilla/packages/client/package.json +++ b/templates/vanilla/packages/client/package.json @@ -5,6 +5,7 @@ "license": "MIT", "type": "module", "scripts": { + "bench": "tsx ./bench.ts", "build": "vite build", "dev": "wait-port localhost:8545 && vite", "preview": "vite preview", @@ -23,7 +24,9 @@ "viem": "2.9.20" }, "devDependencies": { + "@ark/attest": "0.9.2", "@types/react-dom": "18.2.7", + "tsx": "4.16.2", "vite": "^4.2.1", "wait-port": "^1.0.4" } diff --git a/templates/vanilla/packages/client/tsconfig.json b/templates/vanilla/packages/client/tsconfig.json index 555d4a7c24..b8d69d71a9 100644 --- a/templates/vanilla/packages/client/tsconfig.json +++ b/templates/vanilla/packages/client/tsconfig.json @@ -5,7 +5,8 @@ "target": "ESNext", "lib": ["ESNext", "DOM"], "jsx": "react-jsx", - "jsxImportSource": "react" + "jsxImportSource": "react", + "paths": {} }, - "include": ["src"] + "include": ["src", "bench.ts"] } From 886252ef55fa64e1da43b374704a74dce786e02b Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Fri, 19 Jul 2024 09:43:03 +0100 Subject: [PATCH 2/4] add ts-benchmarks test package --- pnpm-lock.yaml | 39 ++++++++++++++----- test/mock-game-contracts/package.json | 5 +-- test/ts-benchmarks/bench.ts | 55 +++++++++++++++++++++++++++ test/ts-benchmarks/package.json | 17 +++++++++ test/ts-benchmarks/tsconfig.json | 6 +++ 5 files changed, 109 insertions(+), 13 deletions(-) create mode 100644 test/ts-benchmarks/bench.ts create mode 100644 test/ts-benchmarks/package.json create mode 100644 test/ts-benchmarks/tsconfig.json diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a10c40bf2f..3057d959a4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1157,15 +1157,27 @@ importers: forge-std: specifier: https://github.com/foundry-rs/forge-std.git#74cfb77e308dd188d2f58864aaf44963ae6b88b1 version: https://codeload.github.com/foundry-rs/forge-std/tar.gz/74cfb77e308dd188d2f58864aaf44963ae6b88b1 - prettier: - specifier: ^2.6.2 - version: 2.8.4 - rimraf: - specifier: ^3.0.2 - version: 3.0.2 - typescript: - specifier: 5.4.2 - version: 5.4.2 + + test/ts-benchmarks: + devDependencies: + '@latticexyz/recs': + specifier: link:../../packages/recs + version: link:../../packages/recs + '@latticexyz/store-sync': + specifier: link:../../packages/store-sync + version: link:../../packages/store-sync + '@latticexyz/world': + specifier: link:../../packages/world + version: link:../../packages/world + tsx: + specifier: 4.16.2 + version: 4.16.2 + viem: + specifier: 2.9.20 + version: 2.9.20(typescript@5.4.2)(zod@3.23.7) + vite: + specifier: ^4.2.1 + version: 4.3.6(@types/node@20.12.12) packages: @@ -13375,6 +13387,15 @@ snapshots: '@types/node': 18.15.11 fsevents: 2.3.3 + vite@4.3.6(@types/node@20.12.12): + dependencies: + esbuild: 0.17.17 + postcss: 8.4.23 + rollup: 3.21.8 + optionalDependencies: + '@types/node': 20.12.12 + fsevents: 2.3.3 + vitest@0.34.6(jsdom@22.1.0): dependencies: '@types/chai': 4.3.5 diff --git a/test/mock-game-contracts/package.json b/test/mock-game-contracts/package.json index d1769f123a..ca8596f689 100644 --- a/test/mock-game-contracts/package.json +++ b/test/mock-game-contracts/package.json @@ -16,9 +16,6 @@ "@latticexyz/world-modules": "workspace:*", "dotenv": "^16.0.3", "ds-test": "https://github.com/dapphub/ds-test.git#e282159d5170298eb2455a6c05280ab5a73a4ef0", - "forge-std": "https://github.com/foundry-rs/forge-std.git#74cfb77e308dd188d2f58864aaf44963ae6b88b1", - "prettier": "^2.6.2", - "rimraf": "^3.0.2", - "typescript": "5.4.2" + "forge-std": "https://github.com/foundry-rs/forge-std.git#74cfb77e308dd188d2f58864aaf44963ae6b88b1" } } diff --git a/test/ts-benchmarks/bench.ts b/test/ts-benchmarks/bench.ts new file mode 100644 index 0000000000..a9b5a0bfd8 --- /dev/null +++ b/test/ts-benchmarks/bench.ts @@ -0,0 +1,55 @@ +import { bench } from "@ark/attest"; +import { syncToRecs } from "@latticexyz/store-sync/recs"; +import { syncToZustand } from "@latticexyz/store-sync/zustand"; +import { Hex, type PublicClient } from "viem"; +import { defineWorld } from "@latticexyz/world"; +import { createWorld } from "@latticexyz/recs"; + +bench("syncToRecs", async () => { + const config = defineWorld({ + namespace: "demo", + tables: { + Position: { + schema: { + entity: "address", + x: "int32", + y: "int32", + }, + key: ["entity"], + }, + }, + }); + + const t = await syncToRecs({ + world: createWorld(), + config, + address: {} as Hex, + publicClient: {} as PublicClient, + }); + + return t; +}).types([43529, "instantiations"]); + +bench("syncToZustand", async () => { + const config = defineWorld({ + namespace: "demo", + tables: { + Position: { + schema: { + entity: "address", + x: "int32", + y: "int32", + }, + key: ["entity"], + }, + }, + }); + + const t = await syncToZustand({ + config, + address: {} as Hex, + publicClient: {} as PublicClient, + }); + + return t; +}).types([43419, "instantiations"]); diff --git a/test/ts-benchmarks/package.json b/test/ts-benchmarks/package.json new file mode 100644 index 0000000000..9abd4c782f --- /dev/null +++ b/test/ts-benchmarks/package.json @@ -0,0 +1,17 @@ +{ + "name": "ts-benchmarks", + "version": "2.0.12", + "private": true, + "license": "MIT", + "scripts": { + "bench": "tsx ./bench" + }, + "devDependencies": { + "@latticexyz/recs": "link:../../packages/recs", + "@latticexyz/store-sync": "link:../../packages/store-sync", + "@latticexyz/world": "link:../../packages/world", + "tsx": "4.16.2", + "viem": "2.9.20", + "vite": "^4.2.1" + } +} diff --git a/test/ts-benchmarks/tsconfig.json b/test/ts-benchmarks/tsconfig.json new file mode 100644 index 0000000000..b4e69ae1f9 --- /dev/null +++ b/test/ts-benchmarks/tsconfig.json @@ -0,0 +1,6 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "dist" + } +} From 49f7375eaf87f0193747ee3166b6b670ad39efa6 Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Fri, 19 Jul 2024 09:47:34 +0100 Subject: [PATCH 3/4] try dts --- pnpm-lock.yaml | 6 +++--- test/ts-benchmarks/bench.ts | 4 ++-- test/ts-benchmarks/package.json | 6 +++--- test/ts-benchmarks/tsconfig.json | 4 +++- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3057d959a4..e33aaabaab 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1161,13 +1161,13 @@ importers: test/ts-benchmarks: devDependencies: '@latticexyz/recs': - specifier: link:../../packages/recs + specifier: workspace:* version: link:../../packages/recs '@latticexyz/store-sync': - specifier: link:../../packages/store-sync + specifier: workspace:* version: link:../../packages/store-sync '@latticexyz/world': - specifier: link:../../packages/world + specifier: workspace:* version: link:../../packages/world tsx: specifier: 4.16.2 diff --git a/test/ts-benchmarks/bench.ts b/test/ts-benchmarks/bench.ts index a9b5a0bfd8..2537213f55 100644 --- a/test/ts-benchmarks/bench.ts +++ b/test/ts-benchmarks/bench.ts @@ -28,7 +28,7 @@ bench("syncToRecs", async () => { }); return t; -}).types([43529, "instantiations"]); +}).types([20704, "instantiations"]); bench("syncToZustand", async () => { const config = defineWorld({ @@ -52,4 +52,4 @@ bench("syncToZustand", async () => { }); return t; -}).types([43419, "instantiations"]); +}).types([20728, "instantiations"]); diff --git a/test/ts-benchmarks/package.json b/test/ts-benchmarks/package.json index 9abd4c782f..0a03af156c 100644 --- a/test/ts-benchmarks/package.json +++ b/test/ts-benchmarks/package.json @@ -7,9 +7,9 @@ "bench": "tsx ./bench" }, "devDependencies": { - "@latticexyz/recs": "link:../../packages/recs", - "@latticexyz/store-sync": "link:../../packages/store-sync", - "@latticexyz/world": "link:../../packages/world", + "@latticexyz/recs": "workspace:*", + "@latticexyz/store-sync": "workspace:*", + "@latticexyz/world": "workspace:*", "tsx": "4.16.2", "viem": "2.9.20", "vite": "^4.2.1" diff --git a/test/ts-benchmarks/tsconfig.json b/test/ts-benchmarks/tsconfig.json index b4e69ae1f9..1d265cab3e 100644 --- a/test/ts-benchmarks/tsconfig.json +++ b/test/ts-benchmarks/tsconfig.json @@ -1,5 +1,7 @@ { - "extends": "../../tsconfig.json", + // We intentionally do not extend the workspace root tsconfig to avoid paths, because we want this project to resolve types using DTS rather than TS source. + "extends": ["../../packages/common/tsconfig.base.json"], + "exclude": ["**/dist", "**/node_modules", "**/docs", "**/e2e"], "compilerOptions": { "outDir": "dist" } From 7cc25c0acf138253cd83c8e8182bfae2a92d7316 Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Fri, 19 Jul 2024 09:49:53 +0100 Subject: [PATCH 4/4] clean up --- .gitignore | 2 +- templates/vanilla/packages/client/bench.ts | 32 ------------------- .../vanilla/packages/client/package.json | 3 -- .../vanilla/packages/client/tsconfig.json | 5 ++- 4 files changed, 3 insertions(+), 39 deletions(-) delete mode 100644 templates/vanilla/packages/client/bench.ts diff --git a/.gitignore b/.gitignore index 232e9bb4d7..9e381979cd 100644 --- a/.gitignore +++ b/.gitignore @@ -22,4 +22,4 @@ test-data/world-logs-bulk-*.json test-data/world-logs-query.json .attest -.tstrace \ No newline at end of file +.tstrace diff --git a/templates/vanilla/packages/client/bench.ts b/templates/vanilla/packages/client/bench.ts deleted file mode 100644 index 3686710921..0000000000 --- a/templates/vanilla/packages/client/bench.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { bench } from "@ark/attest"; -import { syncToRecs } from "@latticexyz/store-sync/recs"; -import { Hex, type PublicClient } from "viem"; -import { defineWorld } from "@latticexyz/world"; -import { createWorld } from "@latticexyz/recs"; - -bench("SyncToRecs", async () => { - const world = createWorld(); - const config = defineWorld({ - namespace: "demo", - tables: { - Position: { - schema: { - entity: "address", - x: "int32", - y: "int32", - }, - key: ["entity"], - }, - }, - }); - - const t = await syncToRecs({ - world, - config, - address: {} as Hex, - publicClient: {} as PublicClient, - startBlock: 0n, - }); - - return t; -}).types([21758, "instantiations"]); diff --git a/templates/vanilla/packages/client/package.json b/templates/vanilla/packages/client/package.json index 179e36f557..58f660b0f5 100644 --- a/templates/vanilla/packages/client/package.json +++ b/templates/vanilla/packages/client/package.json @@ -5,7 +5,6 @@ "license": "MIT", "type": "module", "scripts": { - "bench": "tsx ./bench.ts", "build": "vite build", "dev": "wait-port localhost:8545 && vite", "preview": "vite preview", @@ -24,9 +23,7 @@ "viem": "2.9.20" }, "devDependencies": { - "@ark/attest": "0.9.2", "@types/react-dom": "18.2.7", - "tsx": "4.16.2", "vite": "^4.2.1", "wait-port": "^1.0.4" } diff --git a/templates/vanilla/packages/client/tsconfig.json b/templates/vanilla/packages/client/tsconfig.json index b8d69d71a9..555d4a7c24 100644 --- a/templates/vanilla/packages/client/tsconfig.json +++ b/templates/vanilla/packages/client/tsconfig.json @@ -5,8 +5,7 @@ "target": "ESNext", "lib": ["ESNext", "DOM"], "jsx": "react-jsx", - "jsxImportSource": "react", - "paths": {} + "jsxImportSource": "react" }, - "include": ["src", "bench.ts"] + "include": ["src"] }