News for hackers. Stuff that matters.
Re:Learning math? Think like a cartoonist by xg15 on Monday April 04, 2022 @12:59PM (#30909012)
I think the bit about the definition of multiplication could be applied to code as well: A source file necessarily contains all possible logic flows, no matter if a flow represents the main operation, an obscure special case or parts that are completely unused or practically unreachable. This can easily hide the "gist" of a function among heaps of clutter.

I think some tool would be interesting that took a code traces or coverage information and generated a view of a code file where each line has a font size dependant on how often that line was executed. Ideally, "important" lines would end up with a large font, while special cases, error checks etc would become "fine print".

I'd be curious if this would help making codebases easier to understand.

Re:Learning math? Think like a cartoonist by WanderPanda on Monday April 04, 2022 @01:06PM (#30909103)
That is exactly what profilers do. Xcode gives you a heatmap of what percentage of the execution time has been spent in a particular function (at least in ~2013 when I used this function the last time)
Re:Learning math? Think like a cartoonist by xg15 on Monday April 04, 2022 @01:16PM (#30909252)
True, but I haven't seen profiling results actually applied back to the actual code file, line-by-line.