3
0
Fork 0
websocketd/tests/performances/ipc_message.cr

21 lines
396 B
Crystal

require "benchmark"
require "ipc"
message = IPC::Message.from_json(%({ "mtype" : 3, "utype" : 30, "payload" : "coucou" }))
str_message = %({ "mtype" : 3, "utype" : 30, "payload" : "coucou" })
Benchmark.ips do |bm|
bm.report("from json") do
m = IPC::Message.from_json str_message
end
bm.report("to json") do
message.to_json
end
bm.report("to_packet") do
message.to_packet
end
end