coreutils
[Top][All Lists]
Advanced

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

[coreutils] [PATCH] sort: minor performance tweak with num_processors


From: Paul Eggert
Subject: [coreutils] [PATCH] sort: minor performance tweak with num_processors
Date: Wed, 22 Dec 2010 23:31:31 -0800
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7

* src/sort.c (main): Don't invoke num_processors twice.
---
 src/sort.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/sort.c b/src/sort.c
index f193e04..96e0696 100644
--- a/src/sort.c
+++ b/src/sort.c
@@ -4601,8 +4601,8 @@ main (int argc, char **argv)
     {
       if (!nthreads)
         {
-          nthreads = MIN (DEFAULT_MAX_THREADS,
-                          num_processors (NPROC_CURRENT_OVERRIDABLE));
+          unsigned long int np = num_processors (NPROC_CURRENT_OVERRIDABLE);
+          nthreads = MIN (np, DEFAULT_MAX_THREADS);
         }
 
       /* Avoid integer overflow later.  */
-- 
1.7.2




reply via email to

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