FTXUI/src/ftxui/dom/benchmark_test.cpp
2022-04-28 10:43:31 +02:00

37 lines
1.2 KiB
C++
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include <benchmark/benchmark.h>
#include "ftxui/dom/elements.hpp" // for gauge, separator, operator|, text, Element, hbox, vbox, blink, border, inverted
#include "ftxui/dom/node.hpp" // for Render
#include "ftxui/screen/screen.hpp" // for Screen
namespace ftxui {
static void BencharkBasic(benchmark::State& state) {
while (state.KeepRunning()) {
auto document = vbox({
text("Test"),
separator(),
hbox({
gauge(0.9),
separator() | blink,
gauge(0.5),
separator() | inverted,
gauge(0.1),
separator(),
}),
text("Test"),
}) |
border;
auto root = gauge(1.0);
Screen screen(80, state.range(0));
Render(screen, root);
}
}
BENCHMARK(BencharkBasic)->DenseRange(0, 256, 16);
} // namespace ftxui
// 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