MCPcopy Create free account
hub / github.com/bytedance/sonic-cpp / BM_Encode

Function BM_Encode

benchmark/main.cpp:42–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40
41template <typename Json, typename PR, typename SR>
42static void BM_Encode(benchmark::State &state, std::string_view filename,
43 std::string_view data) {
44 Json json;
45 std::unique_ptr<const PR> pr = json.parse(data);
46
47 for (auto _ : state) {
48 if (!pr || !pr->stringfy()) state.SkipWithError("Failed to do stringfy");
49 }
50
51 state.SetLabel(filename.data());
52 state.SetBytesProcessed(int64_t(state.iterations()) * int64_t(data.size()));
53}
54
55template <typename Json, typename PR, typename SR>
56static void BM_Stat(benchmark::State &state, std::string filename,

Callers

nothing calls this directly

Calls 2

parseMethod · 0.80
stringfyMethod · 0.80

Tested by

no test coverage detected