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
This commit is contained in:
Emil Sjolander
2016-10-25 16:11:37 -07:00
committed by Facebook Github Bot
parent c8d77b2aae
commit 0cc1b83569
2 changed files with 1 additions and 6 deletions

View File

@@ -10,17 +10,12 @@
#include "CSSBenchmark.h"
#include <CSSLayout/CSSLayout.h>
#include <time.h>
// 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,

View File

@@ -15,7 +15,7 @@
#include <stdlib.h>
#include <time.h>
#define NUM_REPETITIONS 100
#define NUM_REPETITIONS 1000
#define CSS_BENCHMARKS(BLOCK) \
int main(int argc, char const *argv[]) { \