Obsolete
/
ipcd
Archived
3
0
Fork 0
This repository has been archived on 2024-06-18. You can view files and clone it, but cannot push or open issues/pull-requests.
ipcd/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