fzy
terminal fuzzy finder picker
git clone https://9o.is/git/fzy.git
commit 7985d8942ec7fa699335381c097c084cfa17e371 parent 0788d9bae552fe42da1da87f401cc94722c62f43 Author: John Hawthorn <john.hawthorn@gmail.com> Date: Wed, 22 Jun 2016 21:43:48 -0700 Use number of processors as worker count Since we're dividing the search set equally between processors, we want to run with the same number of workers that we have CPU execution threads. This avoids having a worker which is starved until the end of execution. Diffstat:
| M | src/choices.c | | | 3 | ++- |
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/choices.c b/src/choices.c @@ -2,6 +2,7 @@ #include <stdio.h> #include <string.h> #include <pthread.h> +#include <unistd.h> #include "choices.h" #include "match.h" @@ -104,7 +105,7 @@ void choices_init(choices_t *c) { c->capacity = c->size = 0; choices_resize(c, INITIAL_CHOICE_CAPACITY); - c->worker_count = 8; + c->worker_count = (int)sysconf(_SC_NPROCESSORS_ONLN); choices_reset_search(c); }