JeffreyWay / laravel-elixir-webpack-official

88 stars 28 forks source link

Forced polling causes high CPU usage #22

Closed jimbojsb closed 8 years ago

jimbojsb commented 8 years ago

Ostensibly, this commit: https://github.com/JeffreyWay/laravel-elixir-webpack-official/commit/8b66f2c1684d4aae9d4072aa9437e104e3188cfe

Ideally this would respect the optional polling configuration that was recently added to Elixir 6.0.0-11

The specific environment where polling is an issue is Docker for Mac, which doesn't need it anyway since it has real inotify events inside the containers.

JeffreyWay commented 8 years ago

I'm cool with removing it entirely. I've never had a need for it. It just seemed like, for certain folks and environments, it refused to work unless they enabled polling.

grusch-it commented 8 years ago

Regarding high CPU usage when in watch mode, see this (merged) pull request and this ticket.

All in all we should add the ignored option to watchOptions. This drops cpu usage dramatically (for me: from 30% to 2%). Disabling polling and ignoring node_modules drops to < 1%

// webpack.config.js

module.exports = {
  watchOptions: {
    poll: false,
    ignored: /node_modules/
  }
}
JeffreyWay commented 8 years ago

Okay done.

eblanshey commented 7 years ago

@jimbojsb

The specific environment where polling is an issue is Docker for Mac, which doesn't need it anyway since it has real inotify events inside the containers.

Can you clarify what you mean here? I'm using Docker for Mac, and watching files is not working. It works only if polling is enabled, which I'd like to avoid to reduce CPU usage.

jimbojsb commented 7 years ago

Do you happen to be using PHPStorm?

eblanshey commented 7 years ago

I am, although I don't see how it's related to this issue. I run the node watcher manually on my terminal.

jimbojsb commented 7 years ago

Try disabling safe file saving. Storm'a auto save makes a new file and then replaces the old one which is not an event that is proxied by docker for mac.