diff --git a/benchmark/pb_benchmark.cpp b/benchmark/pb_benchmark.cpp index fe95ef6a..c73a34b0 100644 --- a/benchmark/pb_benchmark.cpp +++ b/benchmark/pb_benchmark.cpp @@ -28,8 +28,7 @@ class ScopedTimer { void bench(int Count) { // init the benchmark data - stpb::BaseTypeMsg base_type_st{{}, - std::numeric_limits::max(), + stpb::BaseTypeMsg base_type_st{std::numeric_limits::max(), std::numeric_limits::max(), std::numeric_limits::max(), std::numeric_limits::max(), @@ -41,8 +40,7 @@ void bench(int Count) { pb::BaseTypeMsg base_type_msg; SetBaseTypeMsg(base_type_st, base_type_msg); - stpb::IguanaTypeMsg iguana_type_st{{}, - {std::numeric_limits::max()}, + stpb::IguanaTypeMsg iguana_type_st{{std::numeric_limits::max()}, {std::numeric_limits::max()}, {std::numeric_limits::max()}, {std::numeric_limits::max()}, @@ -52,7 +50,6 @@ void bench(int Count) { SetIguanaTypeMsg(iguana_type_st, iguana_type_msg); stpb::RepeatBaseTypeMsg re_base_type_st{ - {}, {std::numeric_limits::max(), std::numeric_limits::min()}, {std::numeric_limits::max(), @@ -69,30 +66,23 @@ void bench(int Count) { SetRepeatBaseTypeMsg(re_base_type_st, re_base_type_msg); stpb::RepeatIguanaTypeMsg re_iguana_type_st{ - {}, - {{0}, {1}, {3}}, - {{4}, {5}, {6}}, - {{7}, {8}, {9}}, - {{10}, {11}, {12}}, - {{13}, {14}, {15}}, - {}, + {{0}, {1}, {3}}, {{4}, {5}, {6}}, {{7}, {8}, {9}}, + {{10}, {11}, {12}}, {{13}, {14}, {15}}, {}, }; pb::RepeatIguanaTypeMsg re_iguana_type_msg; SetRepeatIguanaTypeMsg(re_iguana_type_st, re_iguana_type_msg); stpb::NestedMsg nest_st{ - {}, /* base_msg */ - {{}, 100, 200, 300, 400, 31.4f, 62.8, false, "World", stpb::Enum::BAZ}, + {100, 200, 300, 400, 31.4f, 62.8, false, "World", stpb::Enum::BAZ}, /* repeat_base_msg */ - {{{}, 1, 2, 3, 4, 5.5f, 6.6, true, "Hello", stpb::Enum::FOO}, - {{}, 7, 8, 9, 10, 11.11f, 12.12, false, "Hi", stpb::Enum::BAR}}, - /* iguana_type_msg */ {{}, {100}, {200}, {300}, {400}, {31}, {32}}, + {{1, 2, 3, 4, 5.5f, 6.6, true, "Hello", stpb::Enum::FOO}, + {7, 8, 9, 10, 11.11f, 12.12, false, "Hi", stpb::Enum::BAR}}, + /* iguana_type_msg */ {{100}, {200}, {300}, {400}, {31}, {32}}, /* repeat_iguna_msg */ - {{}, {{1}, {2}, {3}}, {{4}, {5}, {6}}, {{7}, {8}, {9}}}, + {{{1}, {2}, {3}}, {{4}, {5}, {6}}, {{7}, {8}, {9}}}, /* repeat_repeat_base_msg */ - {{{}, - {1, 2, 3}, + {{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11, 12}, @@ -100,8 +90,7 @@ void bench(int Count) { {16.4, 17.5, 18.6}, {"a", "b", "c"}, {stpb::Enum::FOO, stpb::Enum::BAR, stpb::Enum::BAZ}}, - {{}, - {19, 20, 21}, + {{19, 20, 21}, {22, 23, 24}, {25, 26, 27}, {28, 29, 30}, @@ -117,13 +106,12 @@ void bench(int Count) { map_st.sfix64_str_map.emplace(iguana::sfixed64_t{20}, "twenty"); map_st.str_iguana_type_msg_map.emplace( - "first", stpb::IguanaTypeMsg{{}, {10}, {20}, {30}, {40}, {50}, {60}}); + "first", stpb::IguanaTypeMsg{{10}, {20}, {30}, {40}, {50}, {60}}); map_st.str_iguana_type_msg_map.emplace( - "second", stpb::IguanaTypeMsg{{}, {11}, {21}, {31}, {41}, {51}, {61}}); + "second", stpb::IguanaTypeMsg{{11}, {21}, {31}, {41}, {51}, {61}}); map_st.int_repeat_base_msg_map.emplace( - 1, stpb::RepeatBaseTypeMsg{{}, - {1, 2}, + 1, stpb::RepeatBaseTypeMsg{{1, 2}, {3, 4}, {5, 6}, {7, 8}, @@ -132,8 +120,7 @@ void bench(int Count) { {"one", "two"}, {stpb::Enum::FOO, stpb::Enum::BAR}}); map_st.int_repeat_base_msg_map.emplace( - 2, stpb::RepeatBaseTypeMsg{{}, - {2, 3}, + 2, stpb::RepeatBaseTypeMsg{{2, 3}, {4, 5}, {6, 7}, {8, 9}, @@ -144,9 +131,9 @@ void bench(int Count) { pb::MapMsg map_msg{}; SetMapMsg(map_st, map_msg); - stpb::BaseTypeMsg baseTypeMsg{{}, 100, 200, 300, 400, - 31.4f, 62.8, false, "World", stpb::Enum::BAZ}; - stpb::BaseOneofMsg base_one_of_st{{}, 123, baseTypeMsg, 456.78}; + stpb::BaseTypeMsg baseTypeMsg{ + 100, 200, 300, 400, 31.4f, 62.8, false, "World", stpb::Enum::BAZ}; + stpb::BaseOneofMsg base_one_of_st{123, baseTypeMsg, 456.78}; pb::BaseOneofMsg base_one_of_msg; SetBaseOneofMsg(base_one_of_st, base_one_of_msg); @@ -319,12 +306,10 @@ void bench2(int Count) { std::string pb_str; pb_simple.SerializeToString(&pb_str); - stpb::simple_t simple{0, - std::numeric_limits::max(), + stpb::simple_t simple{std::numeric_limits::max(), std::numeric_limits::max(), std::numeric_limits::max(), - std::numeric_limits::max(), - temp}; + std::numeric_limits::max(), temp}; std::string sp_str; iguana::to_pb(simple, sp_str); @@ -405,7 +390,7 @@ void bench3(int Count) { } void bench4(int Count) { - stpb::bench_int32 st_num{0, 10, 20, 31, 42}; + stpb::bench_int32 st_num{10, 20, 31, 42}; mygame::bench_int32 pb_num; pb_num.set_a(10); pb_num.set_b(20);