From: Anton Ivanov <[email protected]>

No point to abuse CPU with sorting (in a worst case scenario -
up to million of rows in OVN) unless a human is reading the result.
The machine on the other side could not care less if it is
sorted or not.

Signed-off-by: Anton Ivanov <[email protected]>
---
 lib/json.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/lib/json.c b/lib/json.c
index 0baf7c622..d4c3d12f7 100644
--- a/lib/json.c
+++ b/lib/json.c
@@ -30,6 +30,9 @@
 #include "unicode.h"
 #include "util.h"
 #include "uuid.h"
+#include "openvswitch/vlog.h"
+
+VLOG_DEFINE_THIS_MODULE(json);
 
 /* The type of a JSON token. */
 enum json_token_type {
@@ -185,7 +188,11 @@ struct json *
 json_serialized_object_create(const struct json *src)
 {
     struct json *json = json_create(JSON_SERIALIZED_OBJECT);
-    json->string = json_to_string(src, JSSF_SORT);
+    if (VLOG_IS_DBG_ENABLED()) {
+        json->string = json_to_string(src, JSSF_SORT);
+    } else {
+        json->string = json_to_string(src, 0);
+    }
     return json;
 }
 
-- 
2.20.1

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to