mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-09-16 16:08:08 +08:00
Add benchmark. (#127)
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
#include <gtest/gtest.h> // for Test, SuiteApiResolver, TestInfo (ptr only), TEST, TestFactoryImpl
|
||||
#include <memory> // for shared_ptr, allocator, make_shared, __shared_ptr_access
|
||||
|
||||
#include "ftxui/component/captured_mouse.hpp" // for ftxui
|
||||
#include "ftxui/component/component_base.hpp" // for ComponentBase, Component
|
||||
#include "gtest/gtest_pred_impl.h" // for Test, SuiteApiResolver, TEST, TestFactoryImpl
|
||||
|
||||
using namespace ftxui;
|
||||
|
||||
|
@@ -206,7 +206,7 @@ void OnExit(int signal) {
|
||||
on_exit_functions.pop();
|
||||
}
|
||||
if (signal)
|
||||
std::raise(signal);
|
||||
std::raise(signal);
|
||||
}
|
||||
|
||||
auto install_signal_handler = [](int sig, SignalHandler handler) {
|
||||
|
35
src/ftxui/dom/benchmark_test.cpp
Normal file
35
src/ftxui/dom/benchmark_test.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
#include <benchmark/benchmark.h>
|
||||
|
||||
#include "ftxui/dom/elements.hpp" // for separator, gauge, operator|, text, Element, blink, inverted, hbox, vbox, border
|
||||
#include "ftxui/dom/node.hpp" // for Render
|
||||
#include "ftxui/screen/box.hpp" // for ftxui
|
||||
#include "ftxui/screen/screen.hpp" // for Screen
|
||||
|
||||
using namespace ftxui;
|
||||
|
||||
static void BencharkBasic(benchmark::State& state) {
|
||||
while (state.KeepRunning()) {
|
||||
auto document = vbox({
|
||||
text(L"Test"),
|
||||
separator(),
|
||||
hbox({
|
||||
gauge(0.9),
|
||||
separator() | blink,
|
||||
gauge(0.5),
|
||||
separator() | inverted,
|
||||
gauge(0.1),
|
||||
separator(),
|
||||
}),
|
||||
text(L"Test"),
|
||||
}) |
|
||||
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
|
Reference in New Issue
Block a user