Code Monkey home page Code Monkey logo

watcherd's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

watcherd's Issues

CPU constantly spinning up and down

I am using devilbox to run 15 local sites for development, and some of those sites have lots of little files (user uploads).
Whenever this script runs, I can hear my CPU fan spin up and down constantly as this script traverses every single directory and sub-directory.

Using the time command, it says it takes almost 2s for the find command to run. I have 807983 files and folders, at least that's the number I get back by counting the number of lines returned from the find command.

I would like to propose a change for the find command to use the -maxdepth 1 option so that it doesn't have to uselessly traverse every single sub-directly since we really only care about the direct folders underneath the /shared/httpd directory (specifically in devilbox). Using the maxdepth option reduces the time it takes to run the command down to just 0.022s which is a significant savings, and could also reduce the amount of disk I/O required as well.

I kind of suspect this script could reduce the lifespan of an SSD because of how much it is looping through all of my files and folders, every few seconds for 8+ hours a day.

And if we really want to optimize, we could also pass the -type d option so the find command only gets folders only instead of both files and folders by default. This could also replace the need for the two grep statements possibly since those seem like there really only used for getting the base folders from what I understand.

I can make a PR if you would like to implement this change.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.