Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#44241 closed defect (bug) (fixed)

Increase the interval used by grunt watch to reduce CPU usage

Reported by: jeremyfelt Owned by: jeremyfelt
Priority: normal Milestone: 5.1
Component: Build/Test Tools Version:
Severity: normal Keywords: has-patch
Cc: Focuses:

Description (last modified by jeremyfelt)

grunt watch appears to use around 40% of my CPU when sitting idle. By default, ​grunt-contrib-watch uses a 100ms interval. Several of the groups in our _watch config specify an interval of 2 seconds, but others defer to the default.

In my local environment (non-VM), if I add options: { interval: 2000 } to the config, colors, test, and phpunit groups, grunt watch CPU usage stays consistently within 2 to 5% at idle.

See ​this related discussion on the grunt-contrib-watch project

If I change all configurations to 1 second, grunt watch CPU usage stays at around 9%.

I'm attaching a patch that applies only the interval addition to each of the other groups.

Attachments (2)

44241.diff​ (879 bytes ) - added by jeremyfelt 8 years ago.
44241.2.diff​ (1.1 KB ) - added by netweb 8 years ago.

Download all attachments as: .zip

Change History (6)

@jeremyfelt
8 years ago

#1 @jeremyfelt
8 years ago

  • Description modified (diff)

@netweb
8 years ago

#2 @netweb
8 years ago

  • Milestone Awaiting Review → 5.0

In 44241.2.diff​ I've moved options: { interval: 2000 } to the top-level option that applies to all the _watch sub-tasks rather than adding it to each sub-task, all watch tasks will default to this 2s value.

Locally my mid-2014 MacBook Pro sees CPU usage from grunt watch sit at ~4%

#3 @jeremyfelt
8 years ago

  • Owner set to jeremyfelt
  • Resolution → fixed
  • Status new → closed

In 43324:

Built/Test Tools: Increase grunt watch interval on all files.

Significantly reduces Grunt's CPU usage when grunt watch is in an idle/watching state.

Props netweb.
Fixes #44241.

#4 @jorbin
8 years ago

  • Milestone 5.0 → 5.1
Note: See TracTickets for help on using tickets.