Skip to content

Commit

Permalink
Run benchmark on each PR (#2193)
Browse files Browse the repository at this point in the history
  • Loading branch information
remusao authored Aug 27, 2021
1 parent 2829e31 commit 7fa07c7
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Benchmark

on: [pull_request]

jobs:
test:
name: Benchmark on node ${{ matrix.node }} and ${{ matrix.os }}

runs-on: ${{ matrix.os }}

strategy:
matrix:
node: [16]
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v2

- name: Use node ${{ matrix.node }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
registry-url: https://registry.npmjs.org

- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Bootstrap
run: yarn bootstrap

- name: Build
run: yarn build

- name: Bundle
run: yarn bundle

- name: Benchmark
run: |
cd ./packages/adblocker-benchmarks
make deps
make cliqz 2>&1 | grep -v Processed > output.txt
- uses: marocchino/sticky-pull-request-comment@v2
with:
path: ./packages/adblocker-benchmarks/output.txt
2 changes: 2 additions & 0 deletions packages/adblocker/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ export function tokenizeWithWildcardsInPlace(
skipLastToken: boolean,
buffer: TokensBuffer,
): void {
// TODO maybe better to check if buffer is full?
// Otherwise we are under-using the space.
const len = Math.min(pattern.length, buffer.remaining() * 2);
let inside = false;
let precedingCh = 0;
Expand Down

0 comments on commit 7fa07c7

Please sign in to comment.