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

Introduce initial benchmarking infrastructure #464

Merged
merged 5 commits into from
May 15, 2024

Conversation

vobst
Copy link
Collaborator

@vobst vobst commented May 7, 2024

To better understand the current performance characteristics and to
guide future development, introduce microbenchmarks for various steps in
the cwe_checker's analysis.

This PR adds benchmarks for the following steps:

  • CFG construction,
  • individual normalization passes,
  • function signatures analysis,
  • pointer inference,
  • string abstractions,
  • individual checkers.

All benchmarks are executed on the following input programs:

  • ls,
  • netfs.ko,

for the following architectures:

  • amd64,
  • arm64,
  • armel,
  • armhf,
  • mips64el,
  • mipsel,
  • ppc64el,
  • x86.

Inputs are stored in the benches/_data/ directory. It contains
json-serialized pcode projects and binaries. The pcode projects are
included for the following reasons:

  • not requiring a Ghidra installation on the benchmarking system,
  • avoid that changes in Ghidra version influence the benchmark results,
  • reduce the time it takes to run the benchmarks.

The inputs are not included in the repository and have to be obtained
from an external source. Since the binaries are taken from Debian
packages it shouldn't be a problem to re-distribute them if we include
the copyright information.

This implementation is based on the Criterion.rs crate. It is added to
the dev-dependencies of the cwe_checker_lib and the Cargo.lock is
updated accordingly.

Benchmark Results

Full results for the current master are available here for future reference.

Even though both full runs were performed on the same, dedicated system with minimized background activity, there are some considerable differences in some benchmarks. I need to investigate this further to get a reproducible setup.

@vobst vobst changed the title Introduce initial benchmarking infrastructure WIP: Introduce initial benchmarking infrastructure May 7, 2024
@vobst vobst force-pushed the initial_benchmarking_infrastructure branch 2 times, most recently from 6cc0a14 to f56691c Compare May 8, 2024 13:05
@vobst vobst marked this pull request as ready for review May 8, 2024 18:47
@vobst vobst requested a review from Enkelmann May 8, 2024 18:47
@vobst vobst changed the title WIP: Introduce initial benchmarking infrastructure Introduce initial benchmarking infrastructure May 8, 2024
@vobst vobst force-pushed the initial_benchmarking_infrastructure branch from f56691c to c3762d7 Compare May 8, 2024 20:47
Copy link
Collaborator Author

@vobst vobst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a bunch of nits.

src/cwe_checker_lib/benches/benchmarks.rs Show resolved Hide resolved
src/cwe_checker_lib/benches/benchmarks.rs Show resolved Hide resolved
src/cwe_checker_lib/benches/benchmarks.rs Outdated Show resolved Hide resolved
src/cwe_checker_lib/benches/benchmarks.rs Show resolved Hide resolved
src/cwe_checker_lib/benches/benchmarks.rs Show resolved Hide resolved
src/cwe_checker_lib/benches/benchmarks.rs Outdated Show resolved Hide resolved
src/cwe_checker_lib/benches/benchmarks.rs Outdated Show resolved Hide resolved
src/cwe_checker_lib/benches/benchmarks.rs Outdated Show resolved Hide resolved
src/cwe_checker_lib/benches/benchmarks.rs Outdated Show resolved Hide resolved
src/cwe_checker_lib/benches/benchmarks.rs Outdated Show resolved Hide resolved
On stable Rust, Criterion.rs can only use and benchmark public
functions. Thus, expose some functions that will be used in the
benchmarks.

Signed-off-by: Valentin Obst <[email protected]>
vobst pushed a commit to vobst/cwe_checker that referenced this pull request May 15, 2024
@vobst vobst force-pushed the initial_benchmarking_infrastructure branch from 6258bc6 to cca43fc Compare May 15, 2024 06:33
Copy link
Collaborator Author

@vobst vobst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few nits.

src/cwe_checker_lib/benches/benchmarks.rs Outdated Show resolved Hide resolved
src/cwe_checker_lib/benches/benchmarks.rs Outdated Show resolved Hide resolved
src/cwe_checker_lib/benches/benchmarks.rs Outdated Show resolved Hide resolved
Valentin Obst added 4 commits May 15, 2024 09:10
On stable Rust, Criterion.rs can only use and benchmark public
functions. Thus, expose some functions that will be used in the
benchmarks.

Signed-off-by: Valentin Obst <[email protected]>
To better understand the current performance characteristics and to
guide future development, introduce microbenchmarks for various steps in
the `cwe_checker`'s analysis.

This commit adds benchmarks for the following steps:

- CFG construction,
- individual normalization passes,
- function signatures analysis,
- pointer inference,
- string abstractions,
- individual checkers.

All benchmarks are executed on the following input programs:

- ls,
- netfs.ko,

for the following architectures:

- amd64,
- arm64,
- armel,
- armhf,
- mips64el,
- mipsel,
- ppc64el,
- x86.

Inputs are stored in the `benches/_data/` directory. It contains
json-serialized pcode projects and binaries. The pcode projects are
included for the following reasons:

- not requiring a Ghidra installation on the benchmarking system,
- avoid that changes in Ghidra version influence the benchmark results,
- reduce the time it takes to run the benchmarks.

The inputs are not included in the repository and have to be obtained
from an external source. Since the binaries are taken from Debian
packages it shouldn't be a problem to re-distribute them if we include
the copyright information.

This implementation is based on the Criterion.rs crate. It is added to
the dev-dependencies of the `cwe_checker_lib` and the `Cargo.lock` is
updated accordingly.

Signed-off-by: Valentin Obst <[email protected]>
@vobst vobst force-pushed the initial_benchmarking_infrastructure branch from cca43fc to c97272c Compare May 15, 2024 07:11
@vobst vobst merged commit 11de213 into fkie-cad:master May 15, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant