On 05/02/2014 02:58 AM, Pádraig Brady wrote:
[PATCH] numfmt: improve processing throughput by 800%
>
The devmsg() calls that took quote_n() arguments,
didn't normally output anything, but still incurred
the overhead of those quote_n() calls.

Good catch, I also thought about that yesterday.

diff --git a/src/system.h b/src/system.h
index a9588e7..f295ad1 100644
--- a/src/system.h
+++ b/src/system.h
@@ -617,6 +617,16 @@ usable_st_size (struct stat const *sb)

  void usage (int status) ATTRIBUTE_NORETURN;

+/* Like error(0, 0, ...), but without an implicit newline.
+   Also a noop unless the global DEV_DEBUG is set.  */
+#define devmsg(...)                    \
+  do                                   \
+    {                                  \
+      if (dev_debug)                   \
+        fprintf (stderr, __VA_ARGS__); \
+    }                                  \
+  while (0)
+
  #define emit_cycle_warning(file_name) \
    do                                  \
      {                                 \


Can we be sure the __VA_ARGS__ macro works everywhere?
It is also used in factor.c, nowhere else.

Otherwise +1 - I can confirm the performance boost.

Thanks & have a nice day,
Berny

Reply via email to