coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] numfmt: improve processing throughput by 800%


From: Bernhard Voelker
Subject: Re: [PATCH] numfmt: improve processing throughput by 800%
Date: Fri, 02 May 2014 13:30:05 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0

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

[Prev in Thread] Current Thread [Next in Thread]