| 9 | using namespace snap::drawing; |
| 10 | |
| 11 | static void doBenchmark(benchmark::State& state, Valdi::Function<void(const Ref<FontManager>&)>&& benchmarkFn) { |
| 12 | auto disableCache = state.range(0) == 0; |
| 13 | auto fontManager = Valdi::makeShared<FontManager>(Valdi::ConsoleLogger::getLogger(), !disableCache); |
| 14 | fontManager->load(); |
| 15 | |
| 16 | auto shouldClearCacheAfterEachIteration = state.range(0) == 1; |
| 17 | for (auto _ : state) { |
| 18 | benchmarkFn(fontManager); |
| 19 | |
| 20 | if (shouldClearCacheAfterEachIteration) { |
| 21 | fontManager->getTextShaper()->clearCache(); |
| 22 | } |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | static void TextLayoutSimpleTextSingleLine(benchmark::State& state) { |
| 27 | doBenchmark(state, [&](const auto& fontManager) { |
no test coverage detected