sink.text.pretty: don't use printf for binary values
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 17 Jun 2019 21:56:02 +0000 (17:56 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Sun, 21 Jul 2019 15:39:24 +0000 (11:39 -0400)
printf is slow compared to simply appending '1' or '0' characters to the
GString.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I2605c1e6d2dc463be237e8eb00f70a84e4c5fd1a
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1507
CI-Build: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
src/plugins/text/pretty/print.c

index 8474c43c1e2107dcb722ef0863ce43706e66191e..5c18a07d5cd4ad5a155f69fc3f75cfdaac6cb13f 100644 (file)
@@ -552,7 +552,8 @@ int print_integer(struct pretty_component *pretty,
                bt_common_g_string_append(pretty->string, "0b");
                _bt_safe_lshift(v.u, 64 - len);
                for (bitnr = 0; bitnr < len; bitnr++) {
-                       bt_common_g_string_append_printf(pretty->string, "%u", (v.u & (1ULL << 63)) ? 1 : 0);
+                       bt_common_g_string_append_c(pretty->string,
+                                               (v.u & (1ULL << 63)) ? '1' : '0');
                        _bt_safe_lshift(v.u, 1);
                }
                break;
This page took 0.024657 seconds and 4 git commands to generate.