Skip to content

Updating every 5 seconds is crude; is it good enough? #3

Open

Description

@ExplodingCabbage

Presently the plugin just spawns a daemon thread that checks every 5 seconds what files and folders should be ignored and shoves them into the appropriate setting in the preferences file. No attempt is made to handle any events triggered by modifying files or settings. This approach has the virtues of:

  • being really simple
  • being guaranteed to catch changes regardless of how they are made (in case, for instance, the user is using two text editors in parallel)

However, I have a couple of worries

  • Is there a risk that this will have a performance impact worth caring about (e.g. in the case of massive repos)?
  • will that up-to-5s delay between making a change and seeing the settings file update ever prove annoying?

Activity

  1. ExplodingCabbage commented on Oct 24, 2014

    @ExplodingCabbage
    OwnerAuthor

    Just shoved my entire home directory into my project including a dozen git repos and there was no performance problem; I think all is fine.

  2. xilin commented on Nov 26, 2014

    @xilin

    I think it is better if you provide a configuration for how long it is to check.
    If there is a manually way to do the check immediately, it is better.

  3. krnlde commented on Apr 13, 2015

    @krnlde

    I experience huge performance problems due to this 5 sec check. I got a project with many files dirs and subdirs (keep in mind that node_modules/ and bower_components/ are excluded and are also constantly checked). Sublime hangs for like 2 sec every 5 secs constantly. Why doesn't it check all .gitignore files once per start and then adds a file listener to this file(s) just changing on demand.

    I had to uninstall the plugin temporarily.

    Should I create a new issue or does this fit into the current one?

  4. ExplodingCabbage commented on Apr 13, 2015

    @ExplodingCabbage
    OwnerAuthor

    Absolutely fits into this one - thanks for the report. I did things this way because I thought it would be good enough and I didn't want to dick around learning how to use file listeners. Sounds like that was a mistake that I now need to solve.

  5. krnlde commented on Apr 13, 2015

    @krnlde

    Thanks man!

  6. krnlde commented on Apr 13, 2015

    @krnlde

    2nd easier approach would be to swap the computation on an extra core/thread. Then Sublime wouldn't hang.

  7. ExplodingCabbage commented on Apr 13, 2015

    @ExplodingCabbage
    OwnerAuthor

    That has its own traps - there are certain methods in the sublime api that fail on windows in sublime text 2 if called from threads other than the main thread. That's why I swapped from using a background thread to using timeouts in c7e735d. But perhaps I can do the expensive stuff in a background thread and then use a timeout to queue only the settings write on the main thread. I'll experiment.

  8. krnlde commented on Apr 13, 2015

    @krnlde

    If it helps https://github.com/jisaacks/GitGutter has a non_blocking: true configuration flag. Maybe you can use some of these insights.

  9. added a commit that references this issue on Apr 30, 2015
  10. ExplodingCabbage commented on Apr 30, 2015

    @ExplodingCabbage
    OwnerAuthor

    Fie and buggery, I tried the "easier" approach of moving as much as possible onto a daemon thread while wrapping the settings access in set_timeout calls, but it does nothing at all to improve the performance when dealing with large repos. I need to think a bit about why. You can see my failed attempt at a fix at 5fa0fe8 if you're interested.

  11. hdavidzhu commented on Jul 13, 2015

    @hdavidzhu

    Is there a way to disable this 5 second update and instead update the listing through a keybinding?

  12. ExplodingCabbage commented on Jul 14, 2015

    @ExplodingCabbage
    OwnerAuthor

    @hdavidzhu not at present, sorry. I'll try to get round to adding that in at some point. (Feel free to offer a PR if you've got the time and inclination to do so.)

  13. Narretz commented on Jul 4, 2016

    @Narretz

    There's really no reason to "watch" the ignored files. How often do you update your gitignore? Just run the command after you made a change and be done with it.

  14. sffc commented on Mar 25, 2018

    @sffc

    Every 5 seconds, this plugin makes sublime freeze and I get the beachball for about a second. My workaround is to install the plugin, let it run once, uninstall the plugin, and reboot Sublime.

  15. sffc commented on Mar 25, 2018

    @sffc

    Why not make this a menu option? I should be able to Command-P and run the plugin on-demand instead of having the daemon thing run automatically every 5 seconds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions