FTXUI/src/ftxui/dom/benchmark_test.cpp

36 lines
1.2 KiB
C++
Raw Normal View History

2021-06-26 06:08:21 +08:00
#include <benchmark/benchmark.h>
#include "ftxui/dom/elements.hpp" // for separator, gauge, operator|, text, Element, blink, inverted, hbox, vbox, border
2022-01-07 18:03:54 +08:00
#include "ftxui/dom/node.hpp" // for Render
#include "ftxui/screen/color.hpp" // for ftxui
#include "ftxui/screen/screen.hpp" // for Screen
2021-06-26 06:08:21 +08:00
using namespace ftxui;
static void BencharkBasic(benchmark::State& state) {
while (state.KeepRunning()) {
auto document = vbox({
text("Test"),
2021-06-26 06:08:21 +08:00
separator(),
hbox({
gauge(0.9),
separator() | blink,
gauge(0.5),
separator() | inverted,
gauge(0.1),
separator(),
}),
text("Test"),
2021-06-26 06:08:21 +08:00
}) |
border;
auto root = gauge(1.0);
Screen screen(80, state.range(0));
Render(screen, root);
}
}
BENCHMARK(BencharkBasic)->DenseRange(0, 256, 16);
// Copyright 2021 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.l