News for hackers. Stuff that matters.
Re:Speeding up the Rust edit-build-run cycle by bluGill on Thursday November 14, 2024 @03:38PM (#42140941)
They use printf. Which they claim is faster.
Re:Speeding up the Rust edit-build-run cycle by dgfitz on Thursday November 14, 2024 @05:01PM (#42141689)
I'm not against printf at all, my lifetime commit history is evidence of that. Do you also think that in the case of a coredump not existing, that printf is faster? Sincere question. I'm having an internal argument with myself about it at the moment and some outside perspective would be most welcome.
Re:Speeding up the Rust edit-build-run cycle by bluGill on Thursday November 14, 2024 @07:54PM (#42142959)
Most of my time with printf degugging is spent trying to reason about the code not compiling.

though you should note that I'm repeating their claims. What I think is hidden.

Re:Speeding up the Rust edit-build-run cycle by ehaliewicz2 on Thursday November 14, 2024 @05:40PM (#42141963)
printf isn't faster if you want to single step through code to find math precision errors.

I've had to do that on a embedded system that didn't support debugging. It was hell.

Re:Speeding up the Rust edit-build-run cycle by dgfitz on Thursday November 14, 2024 @06:55PM (#42142609)
I’ve always wondered why embedded devs make less than “JavaScript-FOTM” devs.
Re:Speeding up the Rust edit-build-run cycle by flohofwoe on Friday November 15, 2024 @03:45AM (#42145022)
Faster than pressing F9 (to set a breakpoint on the current line) and then F5 (to start into the debugger)?

Printf-debugging has its uses, but they are very niche (for instance when you don't have access to a properly integrated debugger). Logging on the other hand is useful, but logs are only one small piece of the puzzle in the overall debugging workflow - usually only for debugging problems that slipped into production and when your code runs on a server (as opposed to a user machine).

Re:Speeding up the Rust edit-build-run cycle by hibbelig on Friday November 15, 2024 @07:49AM (#42146438)
It’s very interesting. I’ve tried to observe myself. It seems that if I can see a breakpoint somewhere and then examine state and then see what the problem is, a debugger is great.

If, however, it’s something where I need to examine state at multiple times in the execution, I lose track in my mind of the state I’ve seen before. This is where print debugging shines: I can see how state evolved over time and spot trends.