GithubHelp home page GithubHelp logo

silky / dr-cabal Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chshersh/dr-cabal

0.0 0.0 0.0 362 KB

๐Ÿ“Š Haskell dependencies build times profiler

Home Page: https://hackage.haskell.org/package/dr-cabal

License: Mozilla Public License 2.0

Haskell 100.00%

dr-cabal's Introduction

dr-cabal

GitHub CI Hackage MPL-2.0 license

dr-cabal is a CLI tool for profiling Haskell dependencies build times.

dr-cabal example

โ„น๏ธ DISCLAIMER: This project is developed and maintained in free time by volunteers. The development may continue for decades or may stop tomorrow. You can use GitHub Sponsorship to support the development of this project.

Install

dr-cabal is a Haskell CLI tool and can be installed either from Hackage or from this repository.

Prerequisites

To start using dr-cabal, make sure you have the required version of cabal-install (a Haskell build tool) and GHC (a Haskell compiler) installed:

Hackage

To install the latest version of dr-cabal from Hackage, follow these steps:

  1. Update Hackage index:

    cabal update
  2. Build dr-cabal from Hackage and copy the resulting executable into the desired location:

    cabal install dr-cabal \
        --install-method=copy \
        --overwrite-policy=always \
        --with-compiler=ghc-9.0.2 \
        --installdir=$HOME/.local/bin

โ„น๏ธ NOTE: Make sure the $HOME/.local/bin directory or the directory of your choice is listed in $PATH.

Sources

To build the latest version of dr-cabal from sources, follow these steps:

  1. Clone this repository:

    git clone https://github.com/chshersh/dr-cabal.git
    cd dr-cabal
  2. Build the package:

    cabal build
  3. Copy executable to the desired location:

    cp $(cabal list-bin exe:dr-cabal) ~/.local/bin/dr-cabal

โ„น๏ธ NOTE: Make sure the ~/.local/bin directory or the directory of your choice is listed in $PATH.

How to use?

dr-cabal usages comprises two steps:

  1. ๐Ÿ‘€ Watching cabal build output and recording data into a JSON file.
  2. ๐ŸŒˆ Producing pretty profiling results.

Watch

โš ๏ธ WARNING: To get meaningful results, the dr-cabal watch command needs to be run when none of the dependencies are build. If you've already build you project, including dependencies, you can purge global Cabal cache using the following command:

rm -rf ~/.cabal

You may prefer a less invasive approach if you have custom global Cabal configurations:

rm -rf ~/.cabal/store

However, with the latter solution you won't see the Downloading phase in the profiling output.

Run the following command inside the project directory, for which you want to build the profile chart:

cabal build all | dr-cabal watch --output=dr-cabal-debug.json

This command watches the cabal build output and records all the relevant steps in the dr-cabal-debug.json file.

If everything is good, you should see output similar to the below one:

dr-cabal watch example

It's also possible to see the time spent on Haddock. You can run with:

cabal build all --enable-documentation --haddock-all | dr-cabal watch --output=dr-cabal-debug.json

Profile

Once you successfully produced a JSON file with all the recorded steps, run the following command to pretty-print the profiling output:

โš ๏ธ WARNING: For better results, make your terminal full-screen.

dr-cabal profile --input=dr-cabal-debug.json

You'll see the output like on the image below:

dr-cabal bigger example

dr-cabal's People

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.