-
-
Notifications
You must be signed in to change notification settings - Fork 170
Add CI for running benchmarks #326
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
587e2ca
Add benchmark script, use hyperfine
YJDoc2 a798db3
Setup CI for running benchmarks and posting comments
YJDoc2 645bf34
Remove prepare step from hyperfine and add date-time in the o/p
YJDoc2 b2c3480
Add markdown-it rs for benchmark comparison
YJDoc2 6f9297b
Apply suggestions from code review
kivikakk e72e9a7
update proc-macro2 crate version
YJDoc2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| name: benchmarks | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: | ||
| - opened | ||
| - reopened | ||
| issue_comment: | ||
| types: | ||
| - created | ||
|
|
||
| jobs: | ||
| run_benchmarks: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| pull-requests: write | ||
| # run either when pull request is opened or when comment body (only on pr) is /run-bench | ||
| if: (github.event_name == 'pull_request') || ((github.event.issue.pull_request != null) && github.event.comment.body == '/run-bench') | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| with: | ||
| submodules: true | ||
| - name: Setup Rust toolchain | ||
| uses: dtolnay/rust-toolchain@stable | ||
| - name: Install hyperfine | ||
| run: cargo install hyperfine | ||
| - name: Install cmake | ||
| run: sudo apt-get update && sudo apt-get install cmake -y | ||
| - name: Build Binaries | ||
| run: make binaries | ||
| - name: Run Benchmarks | ||
| run: make bench-all | ||
| - name: Post result comment | ||
| uses: mshick/add-pr-comment@v2 | ||
| with: | ||
| message-path: bench-output.md | ||
kivikakk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,9 @@ | ||
| [submodule "vendor/cmark-gfm"] | ||
| path = vendor/cmark-gfm | ||
| url = https://github.com/kivikakk/cmark-gfm.git | ||
| [submodule "vendor/pulldown-cmark"] | ||
| path = vendor/pulldown-cmark | ||
| url = https://github.com/raphlinus/pulldown-cmark.git | ||
| [submodule "vendor/markdown-it"] | ||
| path = vendor/markdown-it | ||
| url = https://github.com/rlidwka/markdown-it.rs.git |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,50 @@ | ||
| ROOT:=$(shell git rev-parse --show-toplevel) | ||
| COMMIT:=$(shell git rev-parse --short HEAD) | ||
| MIN_RUNS:=25 | ||
kivikakk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| src/scanners.rs: src/scanners.re | ||
| re2rust -W -Werror -i --no-generation-date -o $@ $< | ||
| cargo fmt | ||
|
|
||
| bench: | ||
| cargo build --release | ||
| (cd vendor/cmark-gfm/; make bench PROG=../../target/release/comrak) | ||
|
|
||
| binaries: build-comrak-branch build-comrak-master build-cmark-gfm build-pulldown-cmark build-markdown-it | ||
|
|
||
| build-comrak-branch: | ||
| cargo build --release | ||
| cp ${ROOT}/target/release/comrak ${ROOT}/benches/comrak-${COMMIT} | ||
|
|
||
| build-comrak-master: | ||
| git clone https://github.com/kivikakk/comrak.git --depth 1 --single-branch ${ROOT}/vendor/comrak || true | ||
| cd ${ROOT}/vendor/comrak && \ | ||
| cargo build --release && \ | ||
| cp ./target/release/comrak ${ROOT}/benches/comrak-main | ||
|
|
||
| build-cmark-gfm: | ||
| cd ${ROOT}/vendor/cmark-gfm && \ | ||
| make && \ | ||
| cp build/src/cmark-gfm ${ROOT}/benches/cmark-gfm | ||
|
|
||
| build-markdown-it: | ||
| cd ${ROOT}/vendor/markdown-it && \ | ||
| cargo build --release && \ | ||
| cp target/release/markdown-it ${ROOT}/benches/markdown-it | ||
|
|
||
| build-pulldown-cmark: | ||
| cd ${ROOT}/vendor/pulldown-cmark && \ | ||
| cargo build --release && \ | ||
| cp target/release/pulldown-cmark ${ROOT}/benches/pulldown-cmark | ||
|
|
||
| bench-comrak: build-comrak-branch | ||
kivikakk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| git clone https://github.com/progit/progit.git ${ROOT}/vendor/progit || true > /dev/null | ||
| cd benches && \ | ||
| hyperfine --warmup 3 --min-runs ${MIN_RUNS} -L binary comrak-${COMMIT} './bench.sh ./{binary}' | ||
|
|
||
| bench-all: binaries | ||
| git clone https://github.com/progit/progit.git ${ROOT}/vendor/progit || true > /dev/null | ||
| cd benches && \ | ||
| hyperfine --warmup 10 --min-runs ${MIN_RUNS} -L binary comrak-${COMMIT},comrak-main,pulldown-cmark,cmark-gfm,markdown-it './bench.sh ./{binary}' --export-markdown ${ROOT}/bench-output.md &&\ | ||
| echo "\n\nRun on" `date -u` >> ${ROOT}/bench-output.md | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| #! /bin/bash | ||
|
|
||
| PROG=$1 | ||
| ROOTDIR=$(git rev-parse --show-toplevel) | ||
|
|
||
| for lang in ar az be ca cs de en eo es es-ni fa fi fr hi hu id it ja ko mk nl no-nb pl pt-br ro ru sr th tr uk vi zh zh-tw; do \ | ||
| cat $ROOTDIR/vendor/progit/$lang/*/*.markdown | $PROG > /dev/null | ||
kivikakk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| done | ||
Submodule markdown-it
added at
c2919d
Submodule pulldown-cmark
added at
34c2bb
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.