diff options
author | Eric Wong <e@80x24.org> | 2021-02-23 04:01:15 -0600 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-02-23 23:04:12 +0000 |
commit | f75c6cf666fa202da782de43fd150bbeceb734e4 (patch) | |
tree | 3c56af0e2f49b749dfb9e9a520b9f7ffba769bcd | |
parent | 238422ea83adbe93145bbd18455ffffb84b53124 (diff) | |
download | public-inbox-f75c6cf666fa202da782de43fd150bbeceb734e4.tar.gz |
While disk I/O is typically buffered for good scheduling, git blob decoding uses a non-trivial amount of CPU time and it helps to leave some CPU available for it.
-rw-r--r-- | lib/PublicInbox/LeiQuery.pm | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/PublicInbox/LeiQuery.pm b/lib/PublicInbox/LeiQuery.pm index 214267ee..743fa3f7 100644 --- a/lib/PublicInbox/LeiQuery.pm +++ b/lib/PublicInbox/LeiQuery.pm @@ -5,6 +5,7 @@ package PublicInbox::LeiQuery; use strict; use v5.10.1; +use POSIX (); sub prep_ext { # externals_each callback my ($lxs, $exclude, $loc) = @_; @@ -94,7 +95,10 @@ sub lei_q { return $self->fail("`$mj' writer jobs must be >= 1"); } PublicInbox::LeiOverview->new($self) or return; - $self->{l2m}->{-wq_nr_workers} = ($mj // $nproc) if $self->{l2m}; + $self->{l2m} and $self->{l2m}->{-wq_nr_workers} = $mj // do { + $mj = POSIX::lround($nproc * 3 / 4); # keep some CPU for git + $mj <= 0 ? 1 : $mj; + }; my %mset_opt = map { $_ => $opt->{$_} } qw(threads limit offset); $mset_opt{asc} = $opt->{'reverse'} ? 1 : 0; |