Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature(progress): re-vamps the performance log for ease of use #698

Merged
merged 1 commit into from Dec 21, 2022

Conversation

sverweij
Copy link
Owner

@sverweij sverweij commented Dec 20, 2022

Description

  • adds user and system CPU timings
  • changes display of memory values from absolute to relative
  • uses the Intl API to format the numbers - so it's closer to what the customer is used to
  • adds the total heap used to the summary on the last line

Motivation and Context

  • The users and system timings give a more fine grained view on what's happening under dependency-cruiser's hood
  • When the log still had absolute values for memory usage I discovered I was continuously doing the math to check what the difference was in each step.
  • The Intl API also does away with some custom formatting that was still going on in the performance log helpers. Added bonus is that it takes the customer's locale into account making for much more recognizable (and readable) numbers.
  • With the delta's the numbers displayed will be smaller as well, allowing to show memory sizes in kB instead of Mb - which gives a clearer view of what is actually going on.

How Has This Been Tested?

  • green ci
  • adapted unit tests
  • manual usage (both on dependency-cruiser itself and on the facebook/react codebase)

Screenshots

After

Note: if the terminal supports color, the logger uses chalk to make things more readable a.o. coloring negative numbers and making titles bold.

$ node ./bin/dependency-cruise.js src bin test configs types tools --config --ignore-known
elapsed real         user       system        ∆ rss  ∆ heapTotal   ∆ heapUsed   ∆ external after step...
------------ ------------ ------------ ------------ ------------ ------------ ------------ ------------ 
       832ms        835ms        101ms   +118,396kB    +84,364kB    +59,833kB     +2,231kB start of node process
        11ms         10ms          1ms       +864kB       +256kB       +420kB          0kB parsing options
        91ms         22ms         11ms     +2,656kB       +544kB     +1,808kB       +583kB cache: checking freshness
...

Before

$ node ./bin/dependency-cruise.js src bin test configs types tools --config --ignore-known
  elapsed       rss heapTotal  heapUsed  external after step...
    751ms     127Mb      84Mb      61Mb       2Mb start of node process
     11ms     128Mb      84Mb      62Mb       2Mb parsing options
     93ms     130Mb      85Mb      63Mb       2Mb cache: checking freshness
...

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • Documentation only change
  • Refactor (non-breaking change which fixes an issue without changing functionality)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • 📖

    • My change doesn't require a documentation update, or ...
    • it does and I have updated it
  • ⚖️

    • The contribution will be subject to The MIT license, and I'm OK with that.
    • The contribution is my own original work.
    • I am ok with the stuff in CONTRIBUTING.md.

@sverweij sverweij force-pushed the feature/revamp-performance-log branch 4 times, most recently from 8c18b6c to a698328 Compare December 21, 2022 10:25
@sverweij sverweij force-pushed the feature/revamp-performance-log branch from a698328 to 9016586 Compare December 21, 2022 10:33
@sverweij sverweij merged commit 88051d6 into develop Dec 21, 2022
@sverweij sverweij deleted the feature/revamp-performance-log branch December 21, 2022 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant