News for hackers. Stuff that matters.
Re:Ask HN: What small library or tool do you want that doesn... by eligro91 on Monday May 02, 2022 @06:21AM (#31233288)
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.

Re:Ask HN: What small library or tool do you want that doesn... by weinzierl on Monday May 02, 2022 @08:22AM (#31234186)
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.

Re:Ask HN: What small library or tool do you want that doesn... by eligro91 on Monday May 02, 2022 @09:49AM (#31235079)
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...

Re:Ask HN: What small library or tool do you want that doesn... by dkarl on Monday May 02, 2022 @07:20AM (#31233705)
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

Re:Ask HN: What small library or tool do you want that doesn... by vidanay on Monday May 02, 2022 @08:17AM (#31234136)
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-...

Re:Ask HN: What small library or tool do you want that doesn... by sidpatil on Monday May 02, 2022 @05:46PM (#31241354)
I believe TortoiseGit has this feature out-of-the-box: https://tortoisegit.org/docs/tortoisegit/tgit-dug-blame.html
Re:Ask HN: What small library or tool do you want that doesn... by ludovicianul on Monday May 02, 2022 @08:27AM (#31234241)
We've built an internal tool which does exactly this. Among a bunch of other correlations
Re:Ask HN: What small library or tool do you want that doesn... by eligro91 on Monday May 02, 2022 @09:37AM (#31234943)
ever thought on making this open-source?
Re:Ask HN: What small library or tool do you want that doesn... by ludovicianul on Tuesday May 03, 2022 @04:03AM (#31245863)
yes. sensitive topic though (for now)
Re:Ask HN: What small library or tool do you want that doesn... by mikewarot on Monday May 02, 2022 @09:16AM (#31234729)
It sounds like you want to combine git blame with performance data.
Re:Ask HN: What small library or tool do you want that doesn... by ozim on Monday May 02, 2022 @07:16AM (#31233674)
What about code that is super important but rarely used like once a year - just when it fails you are in big trouble?
Re:Ask HN: What small library or tool do you want that doesn... by dimitar on Monday May 02, 2022 @06:51AM (#31233502)
This can be approximated by generating a lot of metrics and monitoring executions