I'll have to give this a 👎 , since stated on IRC that this is not actually a problem for him and therefore entirely theoretic. To make an ugly implementation detail like this part of the public API there would have to a very good reason.
morbo learns --sleep to set the poll period of watch
--sleep to morbo that will be used by lib/Mojo/Server/Morbo.pm in the sleep call, will default to the previous value of 1 second.
If you have many watched files then morbo can sit on your CPU more than you would like, setting the sleep value to > 1 second eases this somewhat.
- weixin_39676348 4月前点赞 评论 复制链接分享
- weixin_39996798 4月前
I don't understand the use case. I hardly ever have the "CPU hog issue", but in some projects I just create a startup script with the appropriate "-w" switches to make it watch less files. The reasoning behind this is that I get confused if it takes too long for morbo to detect the changed files.
👎 from me as well.点赞 评论 复制链接分享
It's not a problem for me, but is for my colleagues, and FWIW setting the sleep period to 5s brings the cpu usage on my vm down from around 20% to less than 5%.点赞 评论 复制链接分享
I've rebased as per feedback from IRC and to remove the env variable to prevent exposing this part of the implementation.点赞 评论 复制链接分享
Bump! My colleagues say this has made a significant difference to their development environments. I've done some testing myself, changing sleep to 5s (through this change) cuts about 15% off my full test run time. It affects the host and guests like so on the proc table:
Current (sleep 1s):
%CPU %MEM TIME+ COMMAND 26 1.4 0:13.84 script/myapp
PID COMMAND %CPU 10847 VBoxHeadless 56.2
Changing sleep to 5s:
%CPU %MEM TIME+ COMMAND 12 1.4 0:04.26 script/myapp
Host (not much difference here, but previously this would sit at the top of the running processes, now it only appears every 5s)
PID COMMAND %CPU 10847 VBoxHeadless 43.3
Repeating myself from IRC - we're not watching that many files (c. 600) and they're all in the application lib directory (
lib/) and the mojo defaults (
myapp/lib). So we could glob some out but it wouldn't make much difference as we would then have to stop/start morbo in various cases.点赞 评论 复制链接分享
- weixin_39676348 4月前
Thank you, i'm afraid this pull request as it stands did not pass the vote. While i do have a feeling that some version of this could pass, i don't know exactly what that would look like.点赞 评论 复制链接分享