diff --git a/.github/workflows/ci_benchmark.yml b/.github/workflows/ci_benchmark.yml new file mode 100644 index 0000000..d56fc76 --- /dev/null +++ b/.github/workflows/ci_benchmark.yml @@ -0,0 +1,54 @@ +name: 'šŸŽ–ļø CI ā€” Benchmark' + +on: + pull_request: + workflow_dispatch: + +jobs: + benchmark: + runs-on: ubuntu-latest + timeout-minutes: 5 + strategy: + fail-fast: false + name: Compare + steps: + - name: āž• Actions - Checkout + uses: actions/checkout@v4 + + - name: āž• Actions - Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '22.x' + + - name: āž• Cache dependencies + uses: actions/cache@v4 + with: + path: ~/.npm + key: npm-linux-${{ hashFiles('package-lock.json') }} + restore-keys: npm-linux- + + - name: āž• Actions - Setup Bun + uses: oven-sh/setup-bun@v2 + with: + bun-version: 'latest' + + - name: āž• Actions - Setup Deno + uses: denoland/setup-deno@v1 + with: + deno-version: 'v1.x' + + - name: āž• Cache dependencies (Benchmark) + uses: actions/cache@v4 + with: + path: ~/.npm + key: npm-benchmark-${{ hashFiles('benchmark/package-lock.json') }} + restore-keys: npm-benchmark- + + - name: šŸ“¦ Installing Dependencies + run: npm ci + + - name: šŸš€ Building Poku + run: npm run build + + - name: šŸŽ–ļø Rock it + run: npm run benchmark diff --git a/.gitignore b/.gitignore index 7ec4a1a..47fda40 100755 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ node_modules .DS_Store -deno.lock +/deno.lock /lib /browser /playground diff --git a/benchmark/deno.lock b/benchmark/deno.lock new file mode 100644 index 0000000..d6992e3 --- /dev/null +++ b/benchmark/deno.lock @@ -0,0 +1,33 @@ +{ + "version": "3", + "packages": { + "specifiers": { + "npm:lru-cache@^11.0.0": "npm:lru-cache@11.0.0", + "npm:quick-lru@^7.0.0": "npm:quick-lru@7.0.0" + }, + "npm": { + "lru-cache@11.0.0": { + "integrity": "sha512-Qv32eSV1RSCfhY3fpPE2GNZ8jgM9X7rdAfemLWqTUxwiyIC4jJ6Sy0fZ8H+oLWevO6i4/bizg7c8d8i6bxrzbA==", + "dependencies": {} + }, + "quick-lru@7.0.0": { + "integrity": "sha512-MX8gB7cVYTrYcFfAnfLlhRd0+Toyl8yX8uBx1MrX7K0jegiz9TumwOK27ldXrgDlHRdVi+MqU9Ssw6dr4BNreg==", + "dependencies": {} + } + } + }, + "remote": {}, + "workspace": { + "dependencies": [ + "npm:lru-cache@^11.0.0", + "npm:quick-lru@^7.0.0" + ], + "packageJson": { + "dependencies": [ + "npm:benchmark@^2.1.4", + "npm:lru-cache@^11.0.0", + "npm:quick-lru@^7.0.0" + ] + } + } +} diff --git a/benchmark/lib/index.js b/benchmark/lib/index.js index b071408..62d384b 100644 --- a/benchmark/lib/index.js +++ b/benchmark/lib/index.js @@ -40,7 +40,7 @@ console.log('ā€ŗ \x1b[1mNode.js\x1b[0m'); console.log(`\nšŸš€ Fastest is \x1b[1m${fatest}\x1b[0m\n`); - if (!/^lru.min/.test(fatest)) { + if (!/lru.min/.test(fatest)) { process.exit(1); } }) @@ -79,7 +79,7 @@ console.log('ā€ŗ \x1b[1mBun\x1b[0m'); console.log(`\nšŸš€ Fastest is \x1b[1m${fatest}\x1b[0m\n`); - if (!/^lru.min/.test(fatest)) { + if (!/lru.min/.test(fatest)) { process.exit(1); } }) @@ -118,7 +118,7 @@ console.log('ā€ŗ \x1b[1mDeno\x1b[0m'); console.log(`\nšŸš€ Fastest is \x1b[1m${fatest}\x1b[0m\n`); - if (!/^lru.min/.test(fatest)) { + if (!/lru.min/.test(fatest)) { process.exit(1); } })