2021-06-26 06:08:21 +08:00
|
|
|
|
#include <benchmark/benchmark.h>
|
|
|
|
|
|
2022-04-28 16:43:31 +08:00
|
|
|
|
#include "ftxui/dom/elements.hpp" // for gauge, separator, operator|, text, Element, hbox, vbox, blink, border, inverted
|
2022-01-07 18:03:54 +08:00
|
|
|
|
#include "ftxui/dom/node.hpp" // for Render
|
|
|
|
|
#include "ftxui/screen/screen.hpp" // for Screen
|
2021-06-26 06:08:21 +08:00
|
|
|
|
|
2023-03-27 02:20:02 +08:00
|
|
|
|
// NOLINTBEGIN
|
2022-04-17 21:47:20 +08:00
|
|
|
|
namespace ftxui {
|
2021-06-26 06:08:21 +08:00
|
|
|
|
|
|
|
|
|
static void BencharkBasic(benchmark::State& state) {
|
|
|
|
|
while (state.KeepRunning()) {
|
|
|
|
|
auto document = vbox({
|
2021-08-09 05:25:20 +08:00
|
|
|
|
text("Test"),
|
2021-06-26 06:08:21 +08:00
|
|
|
|
separator(),
|
|
|
|
|
hbox({
|
2023-03-27 02:20:02 +08:00
|
|
|
|
gauge(0.9f),
|
2021-06-26 06:08:21 +08:00
|
|
|
|
separator() | blink,
|
2023-03-27 02:20:02 +08:00
|
|
|
|
gauge(0.5f),
|
2021-06-26 06:08:21 +08:00
|
|
|
|
separator() | inverted,
|
2023-03-27 02:20:02 +08:00
|
|
|
|
gauge(0.1f),
|
2021-06-26 06:08:21 +08:00
|
|
|
|
separator(),
|
|
|
|
|
}),
|
2021-08-09 05:25:20 +08:00
|
|
|
|
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);
|
|
|
|
|
|
2022-04-17 21:47:20 +08:00
|
|
|
|
} // namespace ftxui
|
2023-03-27 02:20:02 +08:00
|
|
|
|
// NOLINTEND
|
2022-04-17 21:47:20 +08:00
|
|
|
|
|
2021-06-26 06:08:21 +08:00
|
|
|
|
// 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
|