Skip to content

Commit

Permalink
Merge pull request #224 from abrown/regex-benchmark
Browse files Browse the repository at this point in the history
Add a regular expression benchmark
  • Loading branch information
fitzgen authored Mar 8, 2023
2 parents 6af503c + 3a1a3c3 commit f77897d
Show file tree
Hide file tree
Showing 10 changed files with 206,338 additions and 0 deletions.
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

0 comments on commit f77897d

Please sign in to comment.