mirror of
https://github.com/google/benchmark.git
synced 2024-12-27 13:00:36 +08:00
8545dfb3ea
* Fix DoNotOptimize() GCC copy overhead (#1340) The issue is that GCC DoNotOptimize() does a full copy of an argument if it's not a pointer and it slows down a benchmark. If an argument is big enough there is a memcpy() call for copying the argument. An argument object can be a big object so DoNotOptimize() could add sufficient overhead and affects benchmark results. The cause is in GCC behavior with asm volatile constraints. Looks like GCC trying to use r(register) constraint for all cases despite object size. See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105519 The solution is the split DoNotOptimize() in two cases - value fits in register and value doesn't fit in register. And use case specific asm constraint. std::is_trivially_copyable trait is needed because "+r" constraint doesn't work with non trivial copyable objects. - Fix requires support C++11 feature std::is_trivially_copyable from GCC compiler. The feature has been supported since GCC 5 - Fallback for GCC version < 5 still exists but it uses "m" constraint which means a little bit more overhead in some cases - Add assembly tests for issued cases Fixes #1340 * Add supported compiler versions info for assembly tests - Assembly tests are inherently non-portable. So explicitly add GCC and Clang versions required for reliable tests passed - Write a warning message if the current compiler version isn't supported |
||
---|---|---|
.. | ||
args_product_test.cc | ||
AssemblyTests.cmake | ||
basic_test.cc | ||
benchmark_gtest.cc | ||
benchmark_name_gtest.cc | ||
benchmark_random_interleaving_gtest.cc | ||
benchmark_setup_teardown_test.cc | ||
benchmark_test.cc | ||
BUILD | ||
clobber_memory_assembly_test.cc | ||
CMakeLists.txt | ||
commandlineflags_gtest.cc | ||
complexity_test.cc | ||
cxx03_test.cc | ||
diagnostics_test.cc | ||
display_aggregates_only_test.cc | ||
donotoptimize_assembly_test.cc | ||
donotoptimize_test.cc | ||
filter_test.cc | ||
fixture_test.cc | ||
internal_threading_test.cc | ||
link_main_test.cc | ||
map_test.cc | ||
memory_manager_test.cc | ||
multiple_ranges_test.cc | ||
options_test.cc | ||
output_test_helper.cc | ||
output_test.h | ||
perf_counters_gtest.cc | ||
perf_counters_test.cc | ||
register_benchmark_test.cc | ||
repetitions_test.cc | ||
report_aggregates_only_test.cc | ||
reporter_output_test.cc | ||
skip_with_error_test.cc | ||
spec_arg_test.cc | ||
spec_arg_verbosity_test.cc | ||
state_assembly_test.cc | ||
statistics_gtest.cc | ||
string_util_gtest.cc | ||
templated_fixture_test.cc | ||
time_unit_gtest.cc | ||
user_counters_tabular_test.cc | ||
user_counters_test.cc | ||
user_counters_thousands_test.cc |