> Christian Brabandt wrote:
>>> let &makeprg = 'make -j'.system('echo -n "$(echo
>>> $(grep -c ^processor /proc/cpuinfo)+1 | bc)"')
>>
>> Your command looks strange, why are you adding 1 there? I
>> think, better is something like:
>>
>> let &makeprg = 'make -j'.system('grep -c ^processor /proc/cpuinfo')
>
> Huh, you think my command is strange: you should see the
> original tip (link in previous message).
>
> I was just adding 1 per the original idea, which is the belief
> that if you have N processors you should pass N+1 to -j so there
> is always a process waiting to be run. Google shows varying
> opinions on that (one rather convincing one I glanced at
> suggested that such fiddling doesn't do anything significant).
>
> I don't know the consequences, but a defect in your command
> above is that makeprg ends up with a NUL (^@) at the end, due
> to the newline output by grep (seen with ':set makeprg?').
Ok, I never cared much about it the number of jobs to run in paralel
with make, but I heard, that you should use as many jobs as
processors/cores you have. One page I googled, even suggested to use
1.5 times the number of processors.
In any case, this one should be slightly better:
:let &makeprg = 'make -j'.system('grep -c ^processor /proc/cpuinfo')[:-2]
and if you want to add one (or perform other calculations), simply
adjust this to (There is no need to do the processing in shell and
fork another couple of processes, since vim can do it perfectly well
itself):
:let &makeprg = 'make -j'.(system('grep -c ^processor /proc/cpuinfo')[:-2]+1)
regards,
Christian
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
No comments:
Post a Comment