From 0cc1b835698c42ea4008bdb9bd8f7786fadc7ff0 Mon Sep 17 00:00:00 2001 From: Emil Sjolander Date: Tue, 25 Oct 2016 16:11:37 -0700 Subject: [PATCH] Remove nanosleep from benchmark measure and increase loop count Summary: sleeping in the measure function was done to ensure we were not regressing in double measure calls. This was before we have CSSLayoutMeasureCacheTest though. Let's switch over benchmark to purely benchmark the algorithm and not simulate measure time. Reviewed By: swolchok Differential Revision: D4078186 fbshipit-source-id: e1c16806b3c8714e223e1cfcb6c43846f8f6bbb2 --- benchmark/CSSBenchmark.c | 5 ----- benchmark/CSSBenchmark.h | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/benchmark/CSSBenchmark.c b/benchmark/CSSBenchmark.c index b5bff56e..0f980a31 100644 --- a/benchmark/CSSBenchmark.c +++ b/benchmark/CSSBenchmark.c @@ -10,17 +10,12 @@ #include "CSSBenchmark.h" #include -#include -// Measure functions can be quite slow, for example when measuring text. -// Simulate this by sleeping for 1 millisecond. static CSSSize _measure(void *context, float width, CSSMeasureMode widthMode, float height, CSSMeasureMode heightMode) { - const struct timespec sleeptime = {0, 1000000}; - nanosleep(&sleeptime, NULL); return (CSSSize){ .width = widthMode == CSSMeasureModeUndefined ? 10 : width, .height = heightMode == CSSMeasureModeUndefined ? 10 : width, diff --git a/benchmark/CSSBenchmark.h b/benchmark/CSSBenchmark.h index 7286356c..f1314e98 100644 --- a/benchmark/CSSBenchmark.h +++ b/benchmark/CSSBenchmark.h @@ -15,7 +15,7 @@ #include #include -#define NUM_REPETITIONS 100 +#define NUM_REPETITIONS 1000 #define CSS_BENCHMARKS(BLOCK) \ int main(int argc, char const *argv[]) { \