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 benchmarks to evaluate overhead #11

Merged
merged 6 commits into from Nov 13, 2020
Merged

Conversation

brawner
Copy link
Contributor

@brawner brawner commented Nov 12, 2020

Based on some feedback from #10 I wanted to measure overhead of different choices with this infrastructure. This adds malloc/realloc benchmarks to measure the overhead of tracking them. It also enables linters for this package.

Signed-off-by: Stephen Brawner brawner@gmail.com

Signed-off-by: Stephen Brawner <brawner@gmail.com>
@brawner brawner requested a review from cottsay November 12, 2020 00:12
@brawner
Copy link
Contributor Author

brawner commented Nov 12, 2020

Building with benchmarks, --packages-select performance_test_fixture

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

Copy link
Member

@cottsay cottsay left a comment

Choose a reason for hiding this comment

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

A couple of comments. Also, please re-run CI with AMENT_RUN_PERFORMANCE_TESTS=1 to see what the results are like.

CMakeLists.txt Outdated Show resolved Hide resolved
test/benchmark/benchmark_malloc_realloc.cpp Outdated Show resolved Hide resolved
test/benchmark/benchmark_malloc_realloc.cpp Outdated Show resolved Hide resolved
Signed-off-by: Stephen Brawner <brawner@gmail.com>
@brawner
Copy link
Contributor Author

brawner commented Nov 12, 2020

Addressed the msbuild warnings, and running this time with the benchmarks actually on (hopefully).

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@brawner
Copy link
Contributor Author

brawner commented Nov 12, 2020

Copy link
Member

@cottsay cottsay left a comment

Choose a reason for hiding this comment

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

Looks good once BENCHMARK_MAIN has been dropped.

@cottsay
Copy link
Member

cottsay commented Nov 12, 2020

This is great. I'd like to note, however, that the LD_PRELOAD is still in effect even though the memory tools aren't active, so there is still additional overhead associated with memory operations. I'm showing 270/70/12 ns for testing with memory tools, with memory tools disabled, and without preloading (respectively).

You'd have to use a separate test and add it with ament_add_google_benchmark, but you could test that here if you'd like. It's up to you.

Signed-off-by: Stephen Brawner <brawner@gmail.com>
@brawner
Copy link
Contributor Author

brawner commented Nov 12, 2020

Added a new test for use without memory tools. I also added logic so that it would be skipped if the other benchmark is skipped.

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

Signed-off-by: Stephen Brawner <brawner@gmail.com>
@brawner
Copy link
Contributor Author

brawner commented Nov 12, 2020

I think I fixed the warnings above

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@brawner
Copy link
Contributor Author

brawner commented Nov 12, 2020

Without memory tools. I'm impressed by the memory latency of this build on cloud VMs.

---------------------------------------------------------------------------------------------------------------------------
Benchmark                                                                                 Time             CPU   Iterations
---------------------------------------------------------------------------------------------------------------------------
BenchmarkFixture/benchmark_on_malloc/Malloc Size:1                                     9.53 ns         9.53 ns     73326267
BenchmarkFixture/benchmark_on_malloc/Malloc Size:16                                    10.2 ns         10.2 ns     69127812
BenchmarkFixture/benchmark_on_malloc/Malloc Size:256                                   10.2 ns         10.2 ns     69155989
BenchmarkFixture/benchmark_on_malloc/Malloc Size:4096                                  23.2 ns         23.2 ns     30191050
BenchmarkFixture/benchmark_on_malloc/Malloc Size:65536                                 27.4 ns         27.4 ns     25594158
BenchmarkFixture/benchmark_on_malloc/Malloc Size:1048576                               25.3 ns         25.3 ns     27656313
BenchmarkFixture/benchmark_on_malloc/Malloc Size:16777216                              25.3 ns         25.3 ns     27711868
BenchmarkFixture/benchmark_on_malloc/Malloc Size:268435456                             4804 ns         4804 ns       145695

Signed-off-by: Stephen Brawner <brawner@gmail.com>
@brawner
Copy link
Contributor Author

brawner commented Nov 12, 2020

Windows is picky about the shift conversion, rebuilding after latest commit

  • Build Status

Copy link
Member

@cottsay cottsay left a comment

Choose a reason for hiding this comment

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

A couple of thoughts on the new stuff.

CMakeLists.txt Outdated Show resolved Hide resolved
Signed-off-by: Stephen Brawner <brawner@gmail.com>
Copy link
Member

@cottsay cottsay left a comment

Choose a reason for hiding this comment

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

Should probably get one last round of CI, but this looks good to me. Thanks for iterating.

@brawner
Copy link
Contributor Author

brawner commented Nov 12, 2020

Hopefully the last round of CI

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@brawner
Copy link
Contributor Author

brawner commented Nov 13, 2020

Warnings on aarch and windows are just the expected ones for benchmarks.

@brawner brawner merged commit 1d57dd6 into main Nov 13, 2020
@delete-merged-branch delete-merged-branch bot deleted the brawner/benchmark-infrastructure branch November 13, 2020 18:19
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

2 participants