summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2018-05-24 23:56:50 +0200
committerPaweł Redman <pawel.redman@gmail.com>2018-05-24 23:56:54 +0200
commit9dffee6932f2ca8dcab810a8cdbc16486b9aaa57 (patch)
tree1ce2d0e2445f7d3fce5bb2abada90f43f1c802f1
parent4802048f85106d518e533967517edf642ec0cd70 (diff)
Use larger chunks.HEADmaster
-rw-r--r--turbowc.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/turbowc.c b/turbowc.c
index 0756549..65a25e1 100644
--- a/turbowc.c
+++ b/turbowc.c
@@ -83,6 +83,8 @@ struct {
.total_mutex = PTHREAD_MUTEX_INITIALIZER
};
+#define CHUNK_SIZE (4194304)
+
static void *thread_f(void *arg)
{
void *data;
@@ -91,13 +93,13 @@ static void *thread_f(void *arg)
while (1) {
pthread_mutex_lock(&data_pool.mutex);
- size = data_pool.left & (~15);
+ size = data_pool.left - data_pool.left % CHUNK_SIZE;
if (!size) {
pthread_mutex_unlock(&data_pool.mutex);
break;
}
- else if (size > 16 * 256 * 64)
- size = 16 * 256 * 64;
+ else if (size > CHUNK_SIZE)
+ size = CHUNK_SIZE;
data = data_pool.cursor;
data_pool.cursor += size;