Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run benchmark on each PR #2193

Merged
merged 3 commits into from
Aug 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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