Hacker News new | ask | show | jobs
by eligro91 1505 days ago
I wish I had a tool which measures the trend of every line code in my codebase in production, and shows me on IDE on the background of each line of code which code is mostly used (dark green background or such) and which code is barely used (in light green), and in gray unused code in production (based on the trend of last few months.

The benefits :

- I will understand during development which code is mission critical, and I should be careful with it, as well as invest more time in optimizing this code and document it better.

- I will understand what the customers do, which flows they use and which flows they avoid, so seeing code which I've developed recently but not used yet - will help me understanding that I'm wasting my time on writing unused features or we did not really understood the customers expectations.

- I will be able to cleanup dead code easily on the go.

It's like a theme park manager walking around in the park and watches which rides has long lines of people and which rides have no lines.. helps the manager understand where to put effort and which rides to remove / replace.

4 comments

The tooling for this exits and is 100% usable.

All you have to do is run a build with coverage enabled and then load the coverage data files into your IDE. At least Eclipse (with EclEmma) shows the results in a way that are pretty close to what you described. I'm sure other IDEs can do the same.

The only thing is that nobody does this on production, because of the performance impact and potentially increased risk.

Yes. I know it's existing as coverage when you run unit-tests.

I'm well aware of the performance impact on production, I guess it's the major challenge here.

Since I'm mainly developing in python - here's a good article about that, he gave some directions to make it faster: https://www.drmaciver.com/2017/09/python-coverage-could-be-f...

I would want something slightly different. I care a lot about how recently code has been changed. I usually don't care how much code is run in production, unless it isn't run at all, and then I care a lot. So:

Code that was changed within the last week: red

Code that was changed within the last month: yellow

Code that hasn't been changed in over a month: normal

Code that hasn't been touched in over a year: green

Dead code: blink tag, DOOM music plays

I really like the idea of a "code heatmap". I actually think this could be easily implemented in one scenario: Visual Studio Code Lens already has that information. Massaging it into a background color probably wouldn't be too difficult.

https://docs.microsoft.com/en-us/visualstudio/ide/find-code-...

I believe TortoiseGit has this feature out-of-the-box: https://tortoisegit.org/docs/tortoisegit/tgit-dug-blame.html
We've built an internal tool which does exactly this. Among a bunch of other correlations
ever thought on making this open-source?
yes. sensitive topic though (for now)
It sounds like you want to combine git blame with performance data.
What about code that is super important but rarely used like once a year - just when it fails you are in big trouble?
This can be approximated by generating a lot of metrics and monitoring executions