File: benchmark_main.cpp

package info (click to toggle)
mstch 1.0.2-7
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 960 kB
  • sloc: cpp: 1,443; sh: 17; makefile: 4
file content (26 lines) | stat: -rw-r--r-- 1,120 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <benchmark/benchmark.h>

#include "mstch/mstch.hpp"

static void basic_usage(benchmark::State& state) {
    std::string comment_tmp{
        "<div class=\"comments\"><h3>{{header}}</h3><ul>"
        "{{#comments}}<li class=\"comment\"><h5>{{name}}</h5>"
        "<p>{{body}}</p></li>{{/comments}}</ul></div>"};

    auto comment_view = mstch::map{
        {"header", std::string{"My Post Comments"}},
            {"comments", mstch::array{
                mstch::map{{"name", std::string{"Joe"}}, {"body", std::string{"Thanks for this post!"}}},
                mstch::map{{"name", std::string{"Sam"}}, {"body", std::string{"Thanks for this post!"}}},
                mstch::map{{"name", std::string{"Heather"}}, {"body", std::string{"Thanks for this post!"}}},
                mstch::map{{"name", std::string{"Kathy"}}, {"body", std::string{"Thanks for this post!"}}},
                mstch::map{{"name", std::string{"George"}}, {"body", std::string{"Thanks for this post!"}}}}}};

    while (state.KeepRunning())
        mstch::render(comment_tmp, comment_view);
}

BENCHMARK(basic_usage);

BENCHMARK_MAIN();