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

Add a regular expression benchmark #224

Merged
merged 2 commits into from
Mar 8, 2023
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
9 changes: 9 additions & 0 deletions benchmarks/regex/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM rust:1.67

RUN rustup target add wasm32-wasi
WORKDIR /usr/src
ADD rust-benchmark rust-benchmark
WORKDIR /usr/src/rust-benchmark
RUN cargo build --release --target wasm32-wasi
RUN cp target/wasm32-wasi/release/regex-wasm-benchmark.wasm /benchmark.wasm
# We output the Wasm file to /benchmark.wasm, where the client expects it.
15 changes: 15 additions & 0 deletions benchmarks/regex/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
This regular expression benchmark measures the time taken to match e-mails,
URIs, and IP addresses in an input text. It is written in Rust and can be
re-compiled using the `Dockerfile` (see [`build.sh`]).

It is significantly adapted from the [regex-benchmark] project, which is [MIT]
licensed. The [`default.input`] text is a concatenation of [Learn X in Y
minutes] which is published under the [Creative Commons Attribution-ShareAlike
3.0 Unported] license.

[`build.sh`]: ../build.sh
[regex-benchmark]: https://github.com/mariomka/regex-benchmark
[MIT]: https://github.com/mariomka/regex-benchmark/blob/master/LICENSE
[`default.input`]: ./default.input
[Learn X in Y minutes]: https://github.com/adambard/learnxinyminutes-docs
[Creative Commons Attribution-ShareAlike 3.0 Unported]: http://creativecommons.org/licenses/by-sa/3.0/deed.en_US
Binary file added benchmarks/regex/benchmark.wasm
Binary file not shown.
Loading