aboutsummaryrefslogtreecommitdiff
path: root/unit_test/unit_test.cc
diff options
context:
space:
mode:
authorFrank Barchard <fbarchard@google.com>2015-09-22 15:47:36 -0700
committerFrank Barchard <fbarchard@google.com>2015-09-22 15:47:36 -0700
commit16f12b58cc8f04b4810b7af31a4009160dd724c0 (patch)
tree47b9de6ace9b76af1992912a2719cddef524080c /unit_test/unit_test.cc
parent2b92ec8d0f9fe8c34d0e857b86b4a0e567e99233 (diff)
downloadlibyuv-16f12b58cc8f04b4810b7af31a4009160dd724c0.tar.gz
Replace random with fastrand
random / rand is slow and impacts performance testing. Although its only called to clear a frame once, a typical profile shows it high in the overall profile, when doing 1000 frames for a benchmark. 95.10% libyuv_unittest libyuv_unittest [.] YUY2ToARGBRow_SSSE3 2.01% libyuv_unittest libc-2.19.so [.] __random_r 1.13% libyuv_unittest libc-2.19.so [.] __random Replace random is a faster version for unittests. set LIBYUV_WIDTH=1280 set LIBYUV_HEIGHT=720 set LIBYUV_REPEAT=999 set LIBYUV_FLAGS=-1 out\release\libyuv_unittest --gtest_filter=*YUY2ToARGB* | findms Was libyuvTest.YUY2ToARGB_Opt (497 ms) Now libyuvTest.YUY2ToARGB_Opt (454 ms) R=harryjin@google.com BUG=none Review URL: https://codereview.chromium.org/1361813002 .
Diffstat (limited to 'unit_test/unit_test.cc')
-rw-r--r--unit_test/unit_test.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/unit_test/unit_test.cc b/unit_test/unit_test.cc
index c848e4c0..4be15536 100644
--- a/unit_test/unit_test.cc
+++ b/unit_test/unit_test.cc
@@ -18,6 +18,8 @@
// TODO(fbarchard): Add command line parsing to pass this as option.
#define BENCHMARK_ITERATIONS 1
+int fastrand_seed = 0xfb;
+
libyuvTest::libyuvTest() : rotate_max_w_(128), rotate_max_h_(128),
benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128),
benchmark_height_(72), disable_cpu_flags_(0) {