Skip to content

Commit 4816d1d

Browse files
README.md: expand benchmarking examples (#5589)
Co-authored-by: Stephan T. Lavavej <[email protected]>
1 parent b49a10b commit 4816d1d

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,32 @@ If you want to see all the other flags you can pass, run:
469469
out\bench\benchmark-<benchmark-name> --help
470470
```
471471

472+
## Other Useful Incantations
473+
474+
To compile the benchmarks with additional compiler options, use the [`CXXFLAGS` environment variable][CXXFLAGS].
475+
Set it after configuring and building the STL, but before configuring and building the benchmarks.
476+
For example, to examine how the `/arch:AVX2` option affects auto-vectorization and bit algorithm intrinsics:
477+
478+
```
479+
set CXXFLAGS=/arch:AVX2
480+
cmake -B out\bench -S benchmarks -G Ninja -DSTL_BINARY_DIR=out\x64
481+
cmake --build out\bench
482+
```
483+
484+
To compile the benchmarks with Clang, use `-DCMAKE_CXX_COMPILER=clang-cl`:
485+
486+
```
487+
cmake -B out\bench -S benchmarks -G Ninja -DSTL_BINARY_DIR=out\x64 -DCMAKE_CXX_COMPILER=clang-cl
488+
cmake --build out\bench
489+
```
490+
491+
To run a benchmark on specific cores (e.g. P-cores vs. E-cores) and with higher priority
492+
(to avoid interference), use the [`start` command][start-command]:
493+
494+
```
495+
start /b /wait /high /affinity 0F out\bench\benchmark-std_copy
496+
```
497+
472498
# Editing And Testing The Debugger Visualizer
473499

474500
### Modify The Visualizer
@@ -581,3 +607,5 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
581607
[ASan]: https://learn.microsoft.com/en-us/cpp/sanitizers/asan
582608
[Import Library]: /docs/import_library.md
583609
[VS 2026 Insiders]: https://visualstudio.microsoft.com/insiders/
610+
[CXXFLAGS]: https://cmake.org/cmake/help/latest/envvar/CXXFLAGS.html
611+
[start-command]: https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/start

0 commit comments

Comments
 (0)