From: Anton Ivanov <[email protected]> There is no point to sort JSON objects when nobody is observing them. Machines do not care if it is sorted or not.
Signed-off-by: Anton Ivanov <[email protected]> --- lib/jsonrpc.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/jsonrpc.c b/lib/jsonrpc.c index c8ce5362e..18777f4d6 100644 --- a/lib/jsonrpc.c +++ b/lib/jsonrpc.c @@ -802,7 +802,15 @@ jsonrpc_msg_to_string(const struct jsonrpc_msg *m) { struct jsonrpc_msg *copy = jsonrpc_msg_clone(m); struct json *json = jsonrpc_msg_to_json(copy); - char *s = json_to_string(json, JSSF_SORT); + char *s; + if (VLOG_IS_DBG_ENABLED()) { + /* We need json sorted only if a human is looking + * at it. No point to sort it if debug is not on. + */ + s = json_to_string(json, JSSF_SORT); + } else { + s = json_to_string(json, 0); + } json_destroy(json); return s; } -- 2.20.1 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
