From 63b769f18a30eb35369a7cdc5e1048cfdbd8eae4 Mon Sep 17 00:00:00 2001 From: j-mendez Date: Mon, 16 Oct 2023 22:14:41 -0400 Subject: [PATCH] bench(audit): add bench --- .github/workflows/bench.yml | 32 +++ Cargo.lock | 394 +++++++++++++++++++++++++- Cargo.toml | 4 +- README.md | 12 + accessibility-rs/src/lib.rs | 2 +- accessibility-tree/victor/src/geom.rs | 30 +- benches/Cargo.toml | 14 + benches/README.md | 15 + benches/audit.rs | 31 ++ benches/mock.rs | 6 + 10 files changed, 516 insertions(+), 24 deletions(-) create mode 100644 .github/workflows/bench.yml create mode 100644 benches/Cargo.toml create mode 100644 benches/README.md create mode 100644 benches/audit.rs create mode 100644 benches/mock.rs diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml new file mode 100644 index 0000000..b873b27 --- /dev/null +++ b/.github/workflows/bench.yml @@ -0,0 +1,32 @@ +name: Benches +on: + push: + branches: [main] + pull_request: + branches: [main] + +env: + CARGO_TERM_COLOR: always + RUST_LOG: "off" + +concurrency: + group: ${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/cache@v3 + id: cache + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - name: Run Benchmark + run: cargo bench --bench audit \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index b5ee176..fbcd33e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -64,6 +64,21 @@ dependencies = [ "xml-rs", ] +[[package]] +name = "addr2line" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + [[package]] name = "ahash" version = "0.8.3" @@ -85,6 +100,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "anes" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" + [[package]] name = "ansi_term" version = "0.12.1" @@ -94,6 +115,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "anstyle" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" + [[package]] name = "anyhow" version = "1.0.75" @@ -118,7 +145,7 @@ version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "hermit-abi", + "hermit-abi 0.1.19", "libc", "winapi", ] @@ -138,12 +165,41 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "backtrace" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + +[[package]] +name = "benches" +version = "0.0.0" +dependencies = [ + "accessibility-rs", + "criterion", +] + [[package]] name = "bitflags" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" + [[package]] name = "bstr" version = "1.7.0" @@ -166,12 +222,54 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" +[[package]] +name = "cast" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" + +[[package]] +name = "cc" +version = "1.0.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "libc", +] + [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "ciborium" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "effd91f6c78e5a4ace8a5d3c0b6bfaec9e2baaef55f3efc00e45fb2e477ee926" +dependencies = [ + "ciborium-io", + "ciborium-ll", + "serde", +] + +[[package]] +name = "ciborium-io" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdf919175532b369853f5d5e20b26b43112613fd6fe7aee757e35f7a44642656" + +[[package]] +name = "ciborium-ll" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "defaa24ecc093c77630e6c15e17c51f5e187bf35ee514f4e2d67baaa96dae22b" +dependencies = [ + "ciborium-io", + "half", +] + [[package]] name = "clap" version = "2.34.0" @@ -180,20 +278,83 @@ checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" dependencies = [ "ansi_term", "atty", - "bitflags", + "bitflags 1.3.2", "strsim", "textwrap", "unicode-width", "vec_map", ] +[[package]] +name = "clap" +version = "4.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d04704f56c2cde07f43e8e2c154b43f216dc5c92fc98ada720177362f953b956" +dependencies = [ + "clap_builder", +] + +[[package]] +name = "clap_builder" +version = "4.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e231faeaca65ebd1ea3c737966bf858971cd38c3849107aa3ea7de90a804e45" +dependencies = [ + "anstyle", + "clap_lex", +] + +[[package]] +name = "clap_lex" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961" + [[package]] name = "cloudabi" version = "0.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" dependencies = [ - "bitflags", + "bitflags 1.3.2", +] + +[[package]] +name = "criterion" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2b12d017a929603d80db1831cd3a24082f8137ce19c69e6447f54f5fc8d692f" +dependencies = [ + "anes", + "cast", + "ciborium", + "clap 4.4.6", + "criterion-plot", + "futures", + "is-terminal", + "itertools", + "num-traits", + "once_cell", + "oorandom", + "plotters", + "rayon", + "regex", + "serde", + "serde_derive", + "serde_json", + "tinytemplate", + "tokio", + "walkdir", +] + +[[package]] +name = "criterion-plot" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b50826342786a51a89e2da3a28f1c32b06e387201bc2d19791f622c673706b1" +dependencies = [ + "cast", + "itertools", ] [[package]] @@ -300,6 +461,16 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +[[package]] +name = "errno" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860" +dependencies = [ + "libc", + "windows-sys", +] + [[package]] name = "euclid" version = "0.19.9" @@ -343,6 +514,67 @@ dependencies = [ "new_debug_unreachable", ] +[[package]] +name = "futures" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" + +[[package]] +name = "futures-io" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" + +[[package]] +name = "futures-sink" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" + +[[package]] +name = "futures-task" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" + +[[package]] +name = "futures-util" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +dependencies = [ + "futures-core", + "futures-sink", + "futures-task", + "pin-project-lite", + "pin-utils", +] + [[package]] name = "fxhash" version = "0.2.1" @@ -374,6 +606,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "gimli" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" + [[package]] name = "glob" version = "0.3.1" @@ -399,7 +637,7 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93e3af942408868f6934a7b85134a3230832b9977cf66125df2f9edcfce4ddcc" dependencies = [ - "bitflags", + "bitflags 1.3.2", "ignore", "walkdir", ] @@ -410,6 +648,12 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eec1c01eb1de97451ee0d60de7d81cf1e72aabefb021616027f3d1c3ec1c723c" +[[package]] +name = "half" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" + [[package]] name = "hashbrown" version = "0.12.3" @@ -437,6 +681,12 @@ dependencies = [ "libc", ] +[[package]] +name = "hermit-abi" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" + [[package]] name = "html5ever" version = "0.26.0" @@ -488,6 +738,17 @@ dependencies = [ "hashbrown 0.14.1", ] +[[package]] +name = "is-terminal" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +dependencies = [ + "hermit-abi 0.3.3", + "rustix", + "windows-sys", +] + [[package]] name = "itertools" version = "0.10.5" @@ -536,6 +797,12 @@ version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" +[[package]] +name = "linux-raw-sys" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" + [[package]] name = "lock_api" version = "0.1.5" @@ -630,6 +897,15 @@ dependencies = [ "autocfg 1.1.0", ] +[[package]] +name = "miniz_oxide" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +dependencies = [ + "adler", +] + [[package]] name = "moite_moite" version = "0.2.0" @@ -666,12 +942,27 @@ dependencies = [ "autocfg 1.1.0", ] +[[package]] +name = "object" +version = "0.32.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +[[package]] +name = "oorandom" +version = "11.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" + [[package]] name = "parking_lot" version = "0.12.1" @@ -771,6 +1062,46 @@ dependencies = [ "siphasher 0.3.11", ] +[[package]] +name = "pin-project-lite" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "plotters" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2c224ba00d7cadd4d5c660deaf2098e5e80e07846537c51f9cfa4be50c1fd45" +dependencies = [ + "num-traits", + "plotters-backend", + "plotters-svg", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "plotters-backend" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e76628b4d3a7581389a35d5b6e2139607ad7c75b17aed325f210aa91f4a9609" + +[[package]] +name = "plotters-svg" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38f6d39893cca0701371e3c27294f09797214b86f1fb951b89ade8ec04e2abab" +dependencies = [ + "plotters-backend", +] + [[package]] name = "ppv-lite86" version = "0.2.17" @@ -1030,7 +1361,7 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -1069,7 +1400,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "722f8b8849ad30f25c77c2b5822d3d13b6bde236b94c2187fc8ab4fb90d1efe6" dependencies = [ "anyhow", - "clap", + "clap 2.34.0", "globwalk", "itertools", "once_cell", @@ -1137,6 +1468,25 @@ dependencies = [ "toml", ] +[[package]] +name = "rustc-demangle" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" + +[[package]] +name = "rustix" +version = "0.38.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "745ecfa778e66b2b63c88a61cb36e0eea109e803b0b86bf9879fbc77c70e86ed" +dependencies = [ + "bitflags 2.4.1", + "errno", + "libc", + "linux-raw-sys", + "windows-sys", +] + [[package]] name = "rustversion" version = "1.0.14" @@ -1176,7 +1526,7 @@ version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b86b100bede4f651059740afc3b6cb83458d7401cb7c1ad96d8a11e91742c86" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cssparser", "fxhash", "log", @@ -1431,6 +1781,26 @@ dependencies = [ "once_cell", ] +[[package]] +name = "tinytemplate" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" +dependencies = [ + "serde", + "serde_json", +] + +[[package]] +name = "tokio" +version = "1.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f38200e3ef7995e5ef13baec2f432a6da0aa9ac495b2c0e8f3b7eec2c92d653" +dependencies = [ + "backtrace", + "pin-project-lite", +] + [[package]] name = "toml" version = "0.7.8" @@ -1580,6 +1950,16 @@ version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" +[[package]] +name = "web-sys" +version = "0.3.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + [[package]] name = "winapi" version = "0.3.9" diff --git a/Cargo.toml b/Cargo.toml index 17816d1..cfba4ba 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,9 @@ resolver = "2" members = [ "accessibility-rs", "accessibility-tree/victor", - "accessibility-scraper" + "accessibility-scraper", + # internal + "benches" ] [workspace.dependencies] diff --git a/README.md b/README.md index 8d80a07..facc734 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,18 @@ To help improve the rules the following needs to be done: 1. [Wasm](https://webassembly.org/) example view [kayle_innate](https://github.com/a11ywatch/kayle/blob/main/kayle_innate/kayle_innate/src/lib.rs#L35). 1. Example integrating with a [headless browser](https://github.com/a11ywatch/kayle/blob/main/kayle/tests/innate.ts#L14). +## Benchmarks + +```sh +audit-speed/core/audit: medium html (4k iterations) +time: [928.16 µs 931.17 µs 933.96 µs] +audit-speed/core/audit: audit speed (4k iterations) +time: [1.1475 ms 1.1507 ms 1.1531 ms] +``` + +Currently audits may take up to `1ms` at `stage 0`. We have goals set to drastically increase the performance after the each stage. Some of the stages are set to be done as the engine is built out. +For now as the audits may take up to `1ms` we are focusing on the rules until performance degrades. + ### License This project is licensed under either of diff --git a/accessibility-rs/src/lib.rs b/accessibility-rs/src/lib.rs index 1fafe6c..c1236e6 100644 --- a/accessibility-rs/src/lib.rs +++ b/accessibility-rs/src/lib.rs @@ -68,7 +68,7 @@ pub struct AuditConfig<'a> { /// the locale of the audit translations pub locale: &'a str, /// the guideline spec - pub spec: Conformance, + pub conformance: Conformance, } impl<'a> AuditConfig<'a> { diff --git a/accessibility-tree/victor/src/geom.rs b/accessibility-tree/victor/src/geom.rs index 5d5afd2..58d8a7a 100644 --- a/accessibility-tree/victor/src/geom.rs +++ b/accessibility-tree/victor/src/geom.rs @@ -25,21 +25,21 @@ pub mod physical { } impl Sides { - pub fn inner_px(&self) -> f32 { - let b = Self::get_px::(self.bottom); - let t = Self::get_px::(self.top); - let l = Self::get_px::(self.left); - let r = Self::get_px::(self.left); - - b + t + l + r - } - - pub fn get_px(v: LengthOrPercentage) -> f32 { - match v { - LengthOrPercentage::Length(l) => l.px, - LengthOrPercentage::Percentage(l) => l.unit_value, - } - } + // pub fn inner_px(&self) -> f32 { + // let b = Self::get_px::(self.bottom); + // let t = Self::get_px::(self.top); + // let l = Self::get_px::(self.left); + // let r = Self::get_px::(self.left); + + // b + t + l + r + // } + + // pub fn get_px(v: LengthOrPercentage) -> f32 { + // match v { + // LengthOrPercentage::Length(l) => l.px, + // LengthOrPercentage::Percentage(l) => l.unit_value, + // } + // } } } diff --git a/benches/Cargo.toml b/benches/Cargo.toml new file mode 100644 index 0000000..ba23025 --- /dev/null +++ b/benches/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "benches" +version = "0.0.0" +publish = false +edition = "2021" + +[dependencies] +criterion = { version = "0.5.1", features = ["html_reports", "async_tokio"] } +accessibility-rs = { path = "../accessibility-rs" } + +[[bench]] +name = "audit" +path = "audit.rs" +harness = false \ No newline at end of file diff --git a/benches/README.md b/benches/README.md new file mode 100644 index 0000000..d90cb7b --- /dev/null +++ b/benches/README.md @@ -0,0 +1,15 @@ +# benchmarks + +Benchmarking the accessibility engine. + +## Stages + +The performance is set at stage 0 of 3 more details of the benchmark goals. Each stage should have major performance increases. + +```sh +# stage 0 +audit-speed/core/audit: medium html (4k iterations) +time: [928.16 µs 931.17 µs 933.96 µs] +audit-speed/core/audit: audit speed (4k iterations) +time: [1.1475 ms 1.1507 ms 1.1531 ms] +``` \ No newline at end of file diff --git a/benches/audit.rs b/benches/audit.rs new file mode 100644 index 0000000..fa054b3 --- /dev/null +++ b/benches/audit.rs @@ -0,0 +1,31 @@ +use accessibility_rs::{audit, AuditConfig}; +use criterion::{black_box, criterion_group, criterion_main, Criterion}; +mod mock; + +/// bench audit speed +pub fn bench_speed(c: &mut Criterion) { + let mut group = c.benchmark_group("audit-speed/core"); + + group.sample_size(60); + + group.bench_function(format!("audit: {}", "medium html"), |b| { + b.iter(|| { + black_box( + audit(AuditConfig::basic(mock::MOCK_WEBSITE_A11YWATCH_HTML)), + ) + }) + }); + + group.bench_function(format!("audit: {}", "medium-large html"), |b| { + b.iter(|| { + black_box( + audit(AuditConfig::basic(mock::MOCK_WEBSITE_HTML)), + ) + }) + }); + + group.finish(); +} + +criterion_group!(benches, bench_speed); +criterion_main!(benches); diff --git a/benches/mock.rs b/benches/mock.rs new file mode 100644 index 0000000..05700a3 --- /dev/null +++ b/benches/mock.rs @@ -0,0 +1,6 @@ +/// mock website data from drake.com +pub static MOCK_WEBSITE_HTML: &'static str = r###" + Drake Industries | Custom, Durable, High-Quality Labels, Asset Tags and Custom Server Bezels
Main_BG_sm

SAME DAY QUOTES
INDUSTRY LEADING PRODUCT IDENTIFICATION

Drake has earned the trust of private industries, US, state & local governments and NASA.
REQUEST QUOTE

Welcome to Drake Industries

Product_Group_Img
Drake Industries is a manufacturer of high-quality, durable labels, nameplates, and ID tags for companies ranging from local restaurants… to PC builders… to NASA. Drake understands that you choose label solutions for your products, equipment and safety areas that incorporate durable materials, exacting production standards and, at times, very specialized designs. For more than 45 years, Drake has earned the trust of private industries, US, state & local governments and NASA.

Products

assetID-1
Labels
barcode-serial1
Nameplates
overlays-1
Equipment Panel Overlays
membraneswitch1
Membrane Switches
custom-badges
OEM Bezel Re-Branding
safetyhazard1
Safety

Capabilities

Drake Industries offers a full range of materials and print/manufacturing capabilities that support our durable label and marking solutions. We are capable of manufacturing a variety of labels and printing on a variety of materials and films. We are a UL® certified label manufacturer, and UL® and CSA® label printer in central Texas.
VIEW OUR LIST

About Drake

We are a manufacturer of high-quality, durable labels, dataplates, and ID tags. Drake understands that you choose label solutions for your products, equipment and safety areas that incorporate durable materials, exacting production standards and very specialized designs. For more than 45 years, Drake has earned the trust of private industries, US, state & local governments and NASA. We’re ready to earn your trust.
LEARN MORE

Request a Quote

Contact Drake to talk to an expert about your project.
GET A QUOTE
+"###; + +pub static MOCK_WEBSITE_A11YWATCH_HTML: &'static str = r###"A11yWatch: The scalable web accessibility service.

We are actively developing the first Web Accessibility Engine built into the browser natively with Rust.

Keep your website performant and accessible all day, every day

Improve your website's inclusion and avoid unexpected charges with A11yWatch's effective cloud-based web accessibility auditing platform.

A11yWatch offers powerful tools to accurately test web inclusivity, enabling you to create websites that are accessible to all. We constantly strive to enhance our coverage, speed, and integrations, ensuring improved productivity and web compliance.

Graph displaying maximum capabilities

Fix, monitor, and learn about your web access

Our web accessibility system is built with a strong reliable infrastructure that is perfect for handling diverse production-level websites with minimal downtime across millions of pages.

Receive rapid and precise accessibility audits with our platform.

  • On-Demand Audits

    Improve user experience with detailed insights and enhance web accessibility quickly.

  • Real-Time Alerts

    Stay informed with real-time alerts that empower action and resolve issues.

  • Expert Recommendations

    Get expert tips and better website access for users of all abilities everywhere.

  • Simple Integrations

    Streamline productivity with multiple integrations and tools for web access.

  • Streaming API

    Simplify testing with a powerful API that meets web accessibility standards.

  • Live Viewer

    Experiment and adjust accessibility properties before deploying code changes.

All the details you need in one location

Get insightful reports across all your websites with real time updates.

Empowering users worldwide

Whether you're a software developer, product manager, or website owner, A11yWatch empowers all users across the globe. Our software is crafted with inclusivity in mind, ensuring that individuals from all corners of the world can benefit from its capabilities and accessibility features.

4

Accessibility guidelines

350M

Requests per week

39ms

Average Scan time

99.99%

Guaranteed uptime

Up to 85% automated web accessibility auditing coverage

Our tool is extremely accurate with almost no false positives. Get coverage across issues across all pages at once with almost no downtime. The time it takes the page to load is about the same time it takes to receive the results for the page. Our state of the art concurrency architecture is one of the most resource efficient and performant to handle millions of scans within seconds.

Used by companies that care about inclusion

Hulu Logo
Expensify Logo
Arrow Logo
A11yWatch Web Accessibility
About A11yWatch

We created A11yWatch from beginning to be fast, flexible, and simple. Our business model is transparent and different compared to normal services. Pricing is fair across the board since we only charge for the time it takes to perform audits on the page.

A11yWatch began as an idea that web accessibility auditing can be done without compromising time and quality. A11yWatch started as a web accessibility monitor or safeguard that could be user focused and simple without overlays.

Expansion comes reasonably when our customers tell their friends about A11yWatch, people start using us for all their client websites, or when others try several web accessibility products and end up choosing us. We want this to be organic.

Our accessibility engine is set to handle multiple edge cases that we take for granted. This includes randomizing agents, and viewports for every page on your web application while delivering real-time detailed reports for auditing.

Customers come first on our end because they’re our only investors. We don’t have VC funding, loans, or any shareholders. This allows us to ship meaningful features and continue updates that make sense to improve our platform.

By supporting a company like ours, you are taking a step towards a unified vision of the internet that aligns with ours: split from large companies, accuracy, and all without compromising reliability, speed or quality of support.

Stay inclusive with confidence

Get started with A11yWatch now for affordable and speedy automated web accessibility tools.

"###; \ No newline at end of file