[aklug] Re: A developer's take on system resource consumption

From: Arthur Corliss <acorliss@nevaeh-linux.org>
Date: Sun Jun 12 2011 - 12:34:31 AKDT

On Sat, 11 Jun 2011, Christopher Howard wrote:

> First, a brief note on the subject of pampered developers: I can't say
> much, I'm afraid, but if someone would care to buy me one of those
> "bigger/faster" PCs, I'd be glad to give it a try for a few months and
> let you know how it affects my coding. ;) I think my second-hand Core 2
> is at least three years old now.

Think about the magnitudes more power your Core 2 has over a single core
PIII that doesn't even have SMT. The Core 2 is still an embarrassment of
riches, relatively speaking.

> Second, there is a flip side to the memory issue -- performance. We put
> stuff in memory so that we have instant access to it. The more memory we
> have, the more freedom we have to do this.

While that's true, that still doesn't ask the question about whether our in
memory structures are as efficiently organized as possible, nor, I'd wager,
does the average developer worry about whether they're keeping something in
memory that has a high utilization enough to make it worth the consumption
of resources. Instead they gratuitiously allocate blocks of memory just
because a) it's easier, and b) the average system has gigabytes of memory so
what's a few more megabytes?

Ironically, such practices can actually hurt application performance. Poor
memory organization and too many lightly used variables can destroy cache
coherency on a single-threaded system, and magnitudes worse on a system
doing real world multitasking. How many developer benchmarks and metrics
are gathered on a dedicated single-threaded system? Damned near all, I'd
bet. (Note: when I say single-threaded I'm talking about not running
concurrent and diverse application processes, not whether an application
itself is threaded or not).

> The guy in your article was whining about how Firefox was consuming half
> a gig of RAM. But you notice he wasn't complaining about how /fast/
> Firefox was. And what he also didn't happen to mention was how many
> browser pages he happened to have open at the time -- which, if he is
> like me, was probably twenty or thirty. I'm no Mozilla dev, but somehow
> I'm thinking that it is not menu buttons taking up all that memory
> space, but hundreds of instances of images, Flash, and so forth, which
> he expected to have instant access to the moment he clicked on any one
> of those tabs. Furthermore, there is lots of other data we want instant
> access to as well, such as link folder contents, browser history, saved
> passwords, and pages we've closed but might want to bring up with the
> back button.

I think you're overlooking Mozilla's historical penchant for memory leaks.
I have personally witnessed firefox grow to multiple gigabytes of memory
over the course of a week even though it did nothing more that display a
single page (auto-refreshing). You're probably right to an extent, but it
still takes a narcissistic developer to program under the assumption that
his application is either the *only* or the most important program running
on a system, and so he has every right to call dibs on every available
system resource.

> I'm not saying memory optimization isn't important, just pointing out
> the other side of the coin: making the best use of all the memory you
> have to get what you really want: performance. If we restrict ourselves
> to programming like we only have 256 MB of RAM then yes, indeed, it is
> pointless to have 8 GB.

Absolutely false, Chris. Your comment would be true if all of us were still
running DOS, but we're not. We're running multi-user, multi-tasking
systems, all the way down to some people's smart phones. In that context
it's not pointless to have 8GB, because you want the lion's share of memory
to be available for the user to run other applications concurrently. We
want our notifications of e-mails, IMs, texts, calendar appointments, stock
ticker, etc., and instant access to the content associated with them. All
of which often requires a different application which is often already
running and polling resources.

Based on that I assert that programming like you only have 256MB of RAM is
actually better for performance for consumers of diverse and rich media
content. An environment that demands concurrency.

I don't know, maybe I just scarred from having to plug in 16KB RAM bricks
onto the back of my home computer as a child. I know you sling code, and I
have no doubt that your views are widely held. And you write more end-user
apps than I do, I focus more on system applications. My goal with my code
is to impact the system as lightly as possible, and that has tacit
acknowledgment of the fact that the system doesn't exist just to run my
code. I have to share the system and its resources with more visible
applications.

         --Arthur Corliss
           Live Free or Die
---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Sun Jun 12 12:34:44 2011

This archive was generated by hypermail 2.1.8 : Sun Jun 12 2011 - 12:34:44 AKDT