Skip to content

Improve performance #23

Merged
merged 8 commits into from
Mar 22, 2019
Merged

Improve performance #23

merged 8 commits into from
Mar 22, 2019

Commits on Mar 22, 2019

  1. Sort tree after build

    The startup time of xdu with big du outputs is longer than it
    needs to be, because the tree is kept sorted while inserting new
    nodes. Because of the locality of "du", we are likely to get
    paths with the same prefix in order (e.g. "/a/b/c/x","/a/b/c/y",
    "/a/b/c"). Each path is split into its components ("a","b",...) and
    these are seached for in the tree to find the correct parent to insert
    the new node. This search can greatly be reduced, if we insert new
    nodes as the first child of the parent, because we are very likely
    to search for exactly this component when we process the next entry.
    
    Always add new nodes as first child of the parent node, sort the tree
    once after the initial build.
    
    Performance comparison
    ======================
    
    This was done with a relative small data file (144857 lines) and
    includes just the startup time (xmainloop disabled).
    
    Before this commit:
    
             368.781008      task-clock (msec)         #    0.728 CPUs utilized
                     24      context-switches          #    0.065 K/sec
                      1      cpu-migrations            #    0.003 K/sec
                  14561      page-faults               #    0.039 M/sec
             1345388200      cycles                    #    3.648 GHz
        <not supported>      stalled-cycles-frontend
        <not supported>      stalled-cycles-backend
             2267580465      instructions              #    1.69  insns per cycle
              527033055      branches                  # 1429.122 M/sec
                1899345      branch-misses             #    0.36% of all branches
    
            0.506452004 seconds time elapsed
    
    After this commit:
    
             162.493654      task-clock (msec)         #    0.546 CPUs utilized
                     28      context-switches          #    0.172 K/sec
                      0      cpu-migrations            #    0.000 K/sec
                  14567      page-faults               #    0.090 M/sec
              591784363      cycles                    #    3.642 GHz
        <not supported>      stalled-cycles-frontend
        <not supported>      stalled-cycles-backend
             1155878943      instructions              #    1.95  insns per cycle
              258056988      branches                  # 1588.105 M/sec
                1570485      branch-misses             #    0.61% of all branches
    
            0.297396523 seconds time elapsed
    donald committed Mar 22, 2019
    Configuration menu
    Copy the full SHA
    fa4bd97 View commit details
    Browse the repository at this point in the history
  2. Remove obsolete function insertchild

    This function has been obsoleted by the previous commit. Remove it.
    donald committed Mar 22, 2019
    Configuration menu
    Copy the full SHA
    2e074ca View commit details
    Browse the repository at this point in the history
  3. Declare internal routines as static

    Use "static" functions where possible to give the compiler more
    freedom for optimizations.
    donald committed Mar 22, 2019
    Configuration menu
    Copy the full SHA
    3a00b22 View commit details
    Browse the repository at this point in the history
  4. Revert "Little improvment for repainting"

    Revert the timer based redraw prevention, because we want to
    take a new approach based on an idle worker.
    
    This reverts commit 99a44dd.
    donald committed Mar 22, 2019
    Configuration menu
    Copy the full SHA
    18c9542 View commit details
    Browse the repository at this point in the history
  5. Remove resize callback

    A resize triggers an Expose event and we are going to handle changed
    windows sizes there. So remove resize callback.
    donald committed Mar 22, 2019
    Configuration menu
    Copy the full SHA
    d3dc43d View commit details
    Browse the repository at this point in the history
  6. Add setRepaintWhenIdle()

    Add a function which will register a (Idle-) work procedure to do the
    redraw when there are no more other events pending.
    
    If the window size has changed after the last redraw, clear the
    window to clean up wrongly scaled relicts.
    donald committed Mar 22, 2019
    Configuration menu
    Copy the full SHA
    4f22d4d View commit details
    Browse the repository at this point in the history
  7. Use work procedure on Expose events.

    Instead of doing a repaint on every Expose event, just trigger the work
    procedure to do a repaint when the queue is idle.
    donald committed Mar 22, 2019
    Configuration menu
    Copy the full SHA
    1ed3a0b View commit details
    Browse the repository at this point in the history
  8. Remove xrepaint_noclear

    Remove the now obsolete function.
    donald committed Mar 22, 2019
    Configuration menu
    Copy the full SHA
    1b83466 View commit details
    Browse the repository at this point in the history