#include "mstch/mstch.hpp" #include #include unsigned long long current_msec() { return std::chrono::time_point_cast( std::chrono::system_clock::now()).time_since_epoch().count(); } int main() { std::string comment_tmp{ "

{{header}}

    " "{{#comments}}
  • {{name}}
    " "

    {{body}}

  • {{/comments}}
"}; 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!"}}} }} }; std::vector times; for (int j = 0; j < 10; j++) { auto start = current_msec(); for (int i = 0; i < 5000; i++) mstch::render(comment_tmp, comment_view); times.push_back(current_msec() - start); } float avg = 0; for (auto i: times) avg += i; avg /= times.size(); std::cout << avg << std::endl; return 0; }