Skip to content
Snippets Groups Projects
  1. Mar 14, 2022
  2. Feb 07, 2022
  3. Feb 03, 2022
  4. Feb 02, 2022
  5. Jan 01, 2022
  6. Dec 21, 2021
  7. Oct 06, 2021
  8. Oct 05, 2021
  9. Jul 28, 2021
    • Yorhel's avatar
      Implement a more efficient hard link counting approach · 0d314ca0
      Yorhel authored
      As aluded to in the previous commit. This approach keeps track of hard
      links information much the same way as ncdu 1.16, with the main
      difference being that the actual /counting/ of hard link sizes is
      deferred until the scan is complete, thus allowing the use of a more
      efficient algorithm and amortizing the counting costs.
      
      As an additional benefit, the links listing in the information window
      now doesn't need a full scan through the in-memory tree anymore.
      
      A few memory usage benchmarks:
      
                    1.16  2.0-beta1  this commit
      root:          429        162          164
      backup:       3969       1686         1601
      many links:    155        194          106
      many links2*:  155        602          106
      
      (I'm surprised my backup dir had enough hard links for this to be an
      improvement)
      (* this is the same as the "many links" benchmarks, but with a few
      parent directories added to increase the tree depth. 2.0-beta1 doesn't
      like that at all)
      
      Performance-wise, refresh and delete operations can still be improved a
      bit.
      0d314ca0
  10. Jul 26, 2021
    • Yorhel's avatar
      Add parent node pointers to Dir struct + remove Parents abstraction · 36bc405a
      Yorhel authored
      While this simplifies the code a bit, it's a regression in the sense
      that it increases memory use.
      
      This commit is yak shaving for another hard link counting approach I'd
      like to try out, which should be a *LOT* less memory hungry compared to
      the current approach. Even though it does, indeed, add an extra cost of
      these parent node pointers.
      36bc405a
  11. Jul 18, 2021
  12. Jul 16, 2021
  13. Jul 14, 2021
  14. Jul 13, 2021
    • Yorhel's avatar
      Implement directory refresh · 6c2ab500
      Yorhel authored
      This complicated the scan code more than I had anticipated and has a
      few inherent bugs with respect to calculating shared hardlink sizes.
      
      Still, the merge approach avoids creating a full copy of the subtree, so
      that's another memory usage related win compared to the C version.
      On the other hand, it does leak memory if nodes can't be reused.
      
      Not quite as well tested as I should have, so I'm sure there's bugs.
      6c2ab500
  15. Jul 06, 2021
    • Yorhel's avatar
      Add link path listing to information window · ff3e3bcc
      Yorhel authored
      Two differences compared to the C version:
      - You can now select individual paths in the listing, pressing enter
        will open the selected path in the browser window.
      - Creating this listing is much slower and requires, in the worst case,
        a full traversal through the in-memory tree. I've tested this without
        the same-dev and shared-parent optimizations (i.e. worst case) on an
        import with 30M files and performance was still quite acceptable - the
        listing completed in a second - so I didn't bother adding a loading
        indicator. On slower systems and even larger trees this may be a
        little annoying, though.
      
      (also, calling nonl() apparently breaks detection of the return key,
      neither \n nor KEY_ENTER are emitted for some reason)
      ff3e3bcc
  16. Jun 11, 2021
    • Yorhel's avatar
      Add item info window · 618972b8
      Yorhel authored
      Doesn't display the item's path anymore (seems rather redundant) but
      adds a few more other fields.
      618972b8
  17. Jun 01, 2021
  18. May 30, 2021
  19. May 29, 2021
    • Yorhel's avatar
      Handle allocation failures · 23903088
      Yorhel authored
      In a similar way to the C version of ncdu: by wrapping malloc(). It's
      simpler to handle allocation failures at the source to allow for easy
      retries, pushing the retries up the stack will complicate code somewhat
      more. Likewise, this is a best-effort approach to handling OOM,
      allocation failures in ncurses aren't handled and display glitches may
      occur when we get an OOM inside a drawing function.
      
      This is a somewhat un-Zig-like way of handling errors and adds
      scary-looking 'catch unreachable's all over the code, but that's okay.
      23903088
    • Yorhel's avatar
      Implement JSON file import · c077c5be
      Yorhel authored
      Performance is looking great, but the code is rather ugly and
      potentially buggy. Also doesn't handle hard links without an "nlink"
      field yet.
      
      Error handling of the import code is different from what I've been doing
      until now. That's intentional, I'll change error handling of other
      pieces to call ui.die() directly rather than propagating error enums.
      The approach is less testable but conceptually simpler, it's perfectly
      fine for a tiny application like ncdu.
      c077c5be
  20. May 24, 2021
  21. May 23, 2021
    • Yorhel's avatar
      Implement all existing browsing display options + some fixes · 7b3ebf92
      Yorhel authored
      I plan to add more display options, but ran out of keys to bind.
      Probably going for a quick-select menu thingy so that we can keep the
      old key bindings for people accustomed to it.
      
      The graph width algorithm is slightly different, but I think this one's
      a minor improvement.
      7b3ebf92
  22. May 11, 2021
  23. May 09, 2021
  24. May 07, 2021
  25. May 06, 2021
    • Yorhel's avatar
      More UI stuff + shave off 16 bytes from model.Dir · 27cb599e
      Yorhel authored
      I initially wanted to keep a directory's block count and size as a
      separate field so that exporting an in-memory tree to a JSON dump would
      be easier to do, but that doesn't seem like a common operation to
      optimize for. We'll probably need the algorithms to subtract sub-items
      from directory counts anyway, so such an export can still be
      implemented, albeit slower.
      27cb599e
  26. May 05, 2021
  27. May 03, 2021
    • Yorhel's avatar
      Link to ncurses + some rudimentary TUI frameworky stuff · 826c2fc0
      Yorhel authored
      I tried playing with zbox (pure Zig termbox-like lib) for a bit, but I
      don't think I want to have to deal with the terminal support issues that
      will inevitably come with it. I already stumbled upon one myself: it
      doesn't properly put the terminal in a sensible state after cleanup in
      tmux. As much as I dislike ncurses, it /is/ ubiquitous and tends to kind
      of work.
      826c2fc0
Loading