21 lines
396 B
Crystal
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
|