]> granicus.if.org Git - imagemagick/blobdiff - MagickCore/thread-private.h
(no commit message)
[imagemagick] / MagickCore / thread-private.h
index f299768c5fc23e782dbdb8222b18963d1154dc8d..a1310daa6a21d06ff828016ac60a8fe7eae0743e 100644 (file)
 extern "C" {
 #endif
 
+#include <MagickCore/cache.h>
+#include <MagickCore/resource_.h>
 #include <MagickCore/thread_.h>
 
-#define ThreadThreshold  64
-#define IsConcurrent(columns,rows) \
-  if (((((columns) > ThreadThreshold) || ((rows) > ThreadThreshold))) && \
-      ((MagickSizeType) (columns*rows) > (ThreadThreshold*ThreadThreshold))) \
-   num_threads(GetMagickResourceLimit(ThreadResource))
-
-#if (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR > 10))
+/*
+  Single threaded unless workload justifies the threading overhead.
+*/
+#define WorkloadThreshold()  (16*GetMagickResourceLimit(ThreadResource))
+#define dynamic_number_threads(image,columns,rows,expression) \
+  if (((((columns) > WorkloadThreshold()) || \
+      ((rows) > WorkloadThreshold()))) && ((MagickSizeType) \
+      ((columns)*(rows)) > (WorkloadThreshold()*WorkloadThreshold())) && \
+      (GetImagePixelCacheType(image) != DiskCache) && (expression)) \
+    num_threads(GetMagickResourceLimit(ThreadResource))
+
+#if (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ > 10))
 #define MagickCachePrefetch(address,mode,locality) \
   __builtin_prefetch(address,mode,locality)
 #else