-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change CLI to employ multithreading by default #4211
Conversation
The difference between these 2 measurements is > 10%, which is quite substantial if they are expected to be equal. Also: |
Also as a follow-up, |
I re-did this experiment, compressing silesia with the default number threads (which on my machine evaluates to 4) and then explicitly passing Overall it seems that there is more noise in the benchmarks with multithreading, but the behavior looks overall as expected.
|
programs/zstdcli.c
Outdated
@@ -1311,7 +1311,7 @@ int main(int argCount, const char* argv[]) | |||
DISPLAYLEVEL(3, "Note: %d physical core(s) detected \n", nbWorkers); | |||
} | |||
} | |||
DISPLAYLEVEL(2, "Compressing with %u worker threads \n", nbWorkers); | |||
DISPLAYLEVEL(3, "Compressing with %u worker threads \n", nbWorkers); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, level 3 seems better
611e4f6
to
2a8502e
Compare
… level >= 4, and add lower bound of 1 for the default number of threads
457fe3f
to
3fe52bf
Compare
Summary
This PR modifies
ZSTDCLI_NBTHREADS_DEFAULT
so that multithreading is used by default when the library is compiled with multithreading support.We use a conservative value of
max(1, min(4, nbCores/4))
worker threads for this default value.Testing
I benchmarked on an Intel(R) Xeon(R) Gold 6138 CPU @ 2.00GHz machine with 80 logical cores. I observed that the default behavior is now similar to the behavior when explicitly doing multi-threaded compression using the
-T
flag.