Add first benchmark
Summary: Implement some very basic benchmarking infra. We need benchmarks in css-layout and I want to add something now so that others have the option to follow an example when implementing a benchmark. Reviewed By: lucasr Differential Revision: D3648889 fbshipit-source-id: 60b93c6e5ed027a37195a9a5d86e681e3e79a5b9
This commit is contained in:
committed by
Facebook Github Bot 2
parent
a0805d0b90
commit
c72321f8a9
31
benchmarks/CSSBenchmark.c
Normal file
31
benchmarks/CSSBenchmark.c
Normal file
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#include "CSSBenchmark.h"
|
||||
|
||||
#include <CSSLayout/CSSLayout.h>
|
||||
|
||||
CSS_BENCHMARKS({
|
||||
|
||||
CSS_BENCHMARK("Stack with flex", {
|
||||
CSSNodeRef root = CSSNodeNew();
|
||||
CSSNodeStyleSetWidth(root, 100);
|
||||
CSSNodeStyleSetHeight(root, 100);
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
CSSNodeRef child = CSSNodeNew();
|
||||
CSSNodeStyleSetHeight(child, 20);
|
||||
CSSNodeStyleSetFlex(child, 1);
|
||||
CSSNodeInsertChild(root, child, 0);
|
||||
}
|
||||
|
||||
CSSNodeCalculateLayout(root, 100, 100, CSSDirectionLTR);
|
||||
});
|
||||
|
||||
});
|
Reference in New Issue
Block a user