MCPcopy Create free account
hub / github.com/apache/qpid-proton / BM_Encode10MbMessage

Function BM_Encode10MbMessage

c/benchmarks/message-encoding.cpp:35–51  ·  view source on GitHub ↗

Initialize message, don't decode? * Issues: * PROTON-2229 pn_data_t initialization lead to low performance */

Source from the content-addressed store, hash-verified

33 * PROTON-2229 pn_data_t initialization lead to low performance
34 */
35static void BM_Encode10MbMessage(benchmark::State &state) {
36 const size_t size = 10 * 1024 * 1024;
37 char *payload = static_cast<char *>(malloc(size));
38 pn_bytes_t bytes = pn_bytes(size, payload);
39
40 for (auto _ : state) {
41 pn_message_t *message = pn_message();
42 pn_data_t *body = pn_message_body(message);
43 for (size_t i = 0; i < state.range(0); i++) {
44 pn_data_put_binary(body, bytes);
45 }
46
47 pn_message_free(message);
48 }
49
50 free(payload);
51}
52
53BENCHMARK(BM_Encode10MbMessage)
54 ->Arg(1)

Callers

nothing calls this directly

Calls 5

pn_messageFunction · 0.85
pn_message_bodyFunction · 0.85
pn_message_freeFunction · 0.85
pn_bytesFunction · 0.50
pn_data_put_binaryFunction · 0.50

Tested by

no test coverage detected