242 points · by tsujp · 4y ago · 51 comments
Debuggers and profilers already exist for the developers of applications to know these things.
this tool seems much more useful for the reverse engineer who is watching memory of a target application visually while they step in a debugger. this wouldn't even be for reading specific values of RAM, again the debugger is usually quite good at that, but instead would be useful to see how things change as execution continues.
One big difference between an intermediate and an expert programmer is that an expert develops their intuition for how the program they write will compile and run. Can you guess correctly how fast, or how slow each function will be? Or what the optimizer will do a good or a bad job at optimizing? Can you tell before you've written your code when avoiding allocations is going to speed things up, and when it won't matter?
Debuggers and profilers honestly aren't very good at giving you a "zoomed out" view of whats going on in your program. Each tool shows you a specific aspect of your program, and hides everything else. For profilers, thats usually what the CPU spends its time on. For debuggers, the execution path of a single function. Godbolt shows how the optimizer works. And so on.
But from my perspective, having more tools which show different aspects of my code is almost always a win. I never know ahead of time which perspective will let me double my program's performance, or halve memory usage. Writing code is easy. Understanding code is much more complex.
So yeah, from a software development point of view I think this is neat! I want to give it a try on some of my programs because I expect to see my mental model animated back at me, and I anticipate being surprised. This looks cool!
I think dumping the raw memory is usually used for debugging (postmortem?) rather than to optimize for performance.
why do people call that tool "Godbolt"? it's "Compiler Explorer."
people who don't have an eye for detail about things like this are always the ones telling me what I'm doing wrong.
Even if I were to debug memory using raw hex, I'd probably take a snapshot and open that in a good hex editor instead of just watching some blocks blink.
Even before that I'd scan through various parts of apple iie memory using the machine language lister. I love to troll thru ram.
Feels really old school. Looks like something from people used to write DOS programs.
The original UNIX programs weren't known for good style or being big free
I think we over-complicate code today because we are promised ease of maintenance, or high-level declaration, or something else, and I don't think those promises have ever come true, except in very small textbook-type examples.
/usr/libexec/xscreensaver/memscroller1. Do you ever have a program that kind of just sucks? A bit slower than you expect, laggy but not in any specific way? The fundamental cause could be many things, but it could be, for example, thrashing memory pointlessly. I've seen processes memset/bzero then write, then memset/bzero for seemingly no reason and the source is difficult to follow.
2. How does struct alignment and malloc alignment impact your program? Maybe you could reduce your working set by using packed structs or changing the order of elements. Maybe you could choose a different allocator. But this tool could show you if you've got a bunch of loose space floating around
1) Justine's blinkenlights and one other I can't remember at the moment have done so previously as well.
Try downloading the older release.