Tell me more ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

My Comcast DVR takes at least three seconds to respond to every remote control keypress, making the simple task of watching television into a frustrating button-mashing experience. My iPhone takes at least fifteen seconds to display text messages and crashes ¼ of the times I try to bring up the iPod app; simply receiving and reading an email often takes well over a minute. Even the navcom in my car has mushy and unresponsive controls, often swallowing successive inputs if I make them less than a few seconds apart.

These are all fixed-hardware end-consumer appliances for which usability should be paramount, and yet they all fail at basic responsiveness and latency. Their software is just too slow.

What's behind this? Is it a technical problem, or a social one? Who or what is responsible?

Is it because these were all written in managed, garbage-collected languages rather than native code? Is it the individual programmers who wrote the software for these devices? In all of these cases the app developers knew exactly what hardware platform they were targeting and what its capabilities were; did they not take it into account? Is it the guy who goes around repeating "optimization is the root of all evil," did he lead them astray? Was it a mentality of "oh it's just an additional 100ms" each time until all those milliseconds add up to minutes? Is it my fault, for having bought these products in the first place?

This is a subjective question, with no single answer, but I'm often frustrated to see so many answers here saying "oh, don't worry about code speed, performance doesn't matter" when clearly at some point it does matter for the end-user who gets stuck with a slow, unresponsive, awful experience.

So, at what point did things go wrong for these products? What can we as programmers do to avoid inflicting this pain on our own customers?

share|improve this question
3  
You're assuming things went wrong. At some point someone said "that's good enough" and shipped their product. If end users accept it, well, there it is. (Not saying it's right, but there has to be a balance between ship it now and ship it never.) – Michael Todd Jun 21 '11 at 23:47
2  
@Michael : That seems to align with "my fault for having bought these devices", or more generally, "our fault as consumers for accepting this level of shoddiness." – Crashworks Jun 21 '11 at 23:50
3  
@Crashworks: Yeah, pretty much. People wouldn't keep selling crapware if we wouldn't keep buying it. – Mason Wheeler Jun 22 '11 at 0:30
3  
They were developed in modern, non-garbage-collected corporations. – Мסž Jun 22 '11 at 4:16
1  
@BlueRaja, you totally misunderstand Knuths quote. – user1249 Jun 22 '11 at 5:52
show 8 more comments

7 Answers

Good question. What I see daily is this.

People work on good-size apps. As they work, performance problems creep in, just like bugs. The difference is - bugs are "bad" - they cry out "find me, and fix me". Performance problems just sit there and get worse. Programmers often think "Well, my code wouldn't have a performance problem. Rather, management needs to buy me a newer/bigger/faster machine."

The fact is, if developers periodically just hunt for performance problems (which is actually very easy) they could simply clean them out.

Instead, the "state of the art" is:

  1. rely on aphorisms like "eschew premature optimization" and 90/10 hoo-haw.
  2. talk bravely about profiling, and sometimes actually try it, often with disappointing results, as you see in all the SO questions about it.
  3. fall back on good old guesswork, disguised as experience and knowledge.

But really, that's negative. To be positive, this method works nearly all the time, and it couldn't be simpler. Here's a detailed example.

share|improve this answer
1  
Mike, one day you and I are going to have to write a book on sampled profiling together; it will be the "Cathedral and the Bazaar" of performance programming. – Crashworks Jun 22 '11 at 2:44
@Crashworks: That would be fun. If you're serious, drop me a line. – Mike Dunlavey Jun 22 '11 at 2:50
@Mike Sure, but later in the summer, I think -- I've got a huge backlog of articles and papers I already owe to GDC, #AltDevBlogADay, and my own employer! – Crashworks Jun 22 '11 at 4:57
I agree in general. But despite misuse by people that don't even think about computational complexity, alone actual performance, sayings like "premature optimization is the root of all evil" (everyone who ever cites this should read the full version) and the 90/10 rule don't say "don't optimize" but "optimize efficently". Nobody gets anything from shaving a millisecond off initialization code; writing code with the intent to make every single line as performant as possible just leads to an unmaintainable mess that distracts from finding solving the relevant performance problems, etc. – delnan Jun 22 '11 at 14:28
@delnan: The first time I remember using random-pausing is around '78, on a Raytheon mini with "halt" and "step" panel buttons. I don't remember ever thinking there was any other way to do it. So, while big-O matters, it mystifies me how people can even discuss optimization in real software without first having the program itself tell them where to concentrate. – Mike Dunlavey Jun 22 '11 at 16:41
show 6 more comments

This isn't a technical problem, it's a marketing and management problem.

You may be rolling your eyes at this point, but please bear with me.

What a company sells is their "product", and the folks who define what that is are "product managers". In tech firms, a lot of other people weigh in on that - user experience experts, yadda yadda. But ultimately, the product mangers are responsible to write the specs for what the user is supposed to get.

So, let's take your Comcast DVR. Ideally, things would work like this:

  1. The product manager writes in a spec, "When a user presses a button on the remote control, and is within 25 feet of the DVR, the DVR must respond to the press within 250 milliseconds".
  2. The technical folks build the hardware, write the embedded software, etc.
  3. The QA testers either approve that the system meets the spec, or bounce it back to the technical team for a fix.

Of course, lots of things can go wrong:

  • The product manager fails to put button response in the spec
  • The QA folks do a mediocre job of testing against the spec
  • Somebody selected technologies that don't permit the spec to be met, so the requirement gets punted
  • The technical staff is short-handed, or somebody accelerated the schedule, and some manager says, "Forget about responsiveness - get this other feature finished."
  • The product manager doesn't publish the responsiveness requirement until so late in the game, it can't be met by the ship date
  • Management decides not to submit anything for QA testing until so late, accelerating slow code would destabilize the product

Did you see all the feckless programmers in there? There weren't any.

I'm not saying we bear no responsibility at all for bad performance - often, it's just as easy and fast to write good, robust, efficient code as it is to write junk.

But really, if the product management and QA staff are all asleep at the wheel, we programmers can't make up for that.


FWIW, I completely agree about the abysmal interfaces of most consumer products. I've been writing UI code now for about 25 years, and I strive for elegance and simplicity. It's actually a problem because I think about it so much, I'm now lousy at figuring out badly-designed user interfaces, so my poor wife winds up running most of the devices in our media center.

share|improve this answer
+1 - Problems (bugs or performance) with end products can never be blamed on programmers. If a product has passed the multiple levels of testing required then the programmer has done his job correctly. If a product passes tests and there are problems with it then the testing/specification is to blame. – Qwerky Jun 22 '11 at 11:32
4  
+1 Nicely written, especially about product management etc. However, I disagree about the responsibility. I put it on the people who educate programmers, resulting in programmers not actually knowing how to find performance bugs (and how easy it is, compared to correctness bugs). – Mike Dunlavey Jun 22 '11 at 12:29
@Mike: Quite true. In my first lead role, one of my reports was a guy who'd just gotten an MSCS from Stanford who had only been taught to write "correct" code, and thought I was very odd for also expecting a simple two-level nested loop not to leave the CPU on its knees gasping for oxygen in a multitasking commercial product. There was a little mentoring to be done there. :-) – Bob Murphy Jun 22 '11 at 17:51

Because programmers are not perfect.

I am a programmer of embedded things. Some of my code is not perfect. Most of my embedded code is fast.

To fix performance problems at the end of a project is very hard.

Sometimes, to keep things simple ( and therefore testable, develop-able in realistic time, not fatally buggy) we layer things, like the remote input to a "service" that isn't part of the main application. End result, latency. The alternative is to put everything in a monolithic application is a buggy disaster in C or C++ (the two most common embedded languages.)

Sometimes your embedded device has a process scheduler that doesn't do what you as a user wants. Damn hard to fix as an embedded developer.

Complexity causes the lagging, because of latency on layering. You asked for the features. Try a really old Nokia, like the old 3210. Zippy fast UI. Not many features.

I'm arguing that developers don't get any smarter, so faster hardware gets absorbed on abstractions to prevent features killing each other. (Or not, in the case of your iPhone)

UI performance needs to be a requirement that you test to as the design progresses.

If it isn't specified, the developer will get used to it. We all do this. "My baby is not ugly"

And it's not the GC languages; embedded Realtime Java is so quick it's scary. (Embedded Python on the other hand is a total dog)

I write a program the reads switches on digital inputs as the UI. Still have to de-bounce the switch, so really fast flicking the switch doesn't work, because the de-bounce is a couple of layers up. Ideally I'd have de-bounce logic at the bottom of the firmware stack, but that's not how the hardware works.

Some DVD players just run a "eject" script to do eject. You DVR may have taken this approach to keep development costs sane. Then you skimp on CPU or RAM and it sucks.

share|improve this answer
1  
+1 Especially for "My baby is not ugly", and the debouncing stuff. I did some embedded work way back when (in Pascal, believe it). Once it was painting floating point numbers on a video, and being painfully slow about it. One weekend I plugged in the ICE, took a stackshot (in hex), and puzzled it out. It was in the floating point emulator, being called from a routine that peels off each digit by dividing, truncating, multiplying, subtracting, etc. And of course that was my code. (I found a better way to do it.) – Mike Dunlavey Jun 22 '11 at 13:04

Premature optimization is sometimes bad, but not when required for good user experience or good battery life in a sufficiently constrained system. The failure is the fault of giving a higher priority to clean maintainable software engineering over cooking in whatever it takes to provide good user experience and decent battery life as a higher priority at the beginning of a project, even if it's much harder to maintain and short circuits some cleanly architected software stack and methodology.

If you have an iPhone 3G, Apple released a couple OS updates that were only optimized for newer devices. Later OS updates for the 3G may provide slightly better performance on the 3G.

share|improve this answer
"Premature optimization is sometimes bad, but not when required for good user experience" then it's not premature optimization – Carlos Campderrós Jun 22 '11 at 14:38
1  
Sometimes you have to start optimizing lots of stuff before you have metrics on the actual bottlenecks that require optimization, else the system comes out architected wrong for post-optimization that meets schedule and performance. – hotpaw2 Jun 22 '11 at 15:31

Your first mistake, and probably why you have got a down vote it deserves the blatantly obvious exaggeration. Do you really expect to believe the iPhone and iPad are that bad.

Ultimately the customer is responsible. It comes down to cost and what the customer is prepared to pay and what they get in return. If they choose features over speed, that's what they get. If they choose price over speed, that's what gets built and sold. If brand image is more important..... Ultimately the customer decides with their wallet, whats important and whats not. You have a choice to be a brand whore and buy products because everyone else does, or be an independent thinker, look behind the gloss and marketing hype, and buy something that meets your needs.

You are blaming the programmers. They wrote the code, sure, but they did not define, and should not define, the customers requirements, the hardware, the BOM cost, the R&D cost, the marketing budget..... all the things that go to make a product, that is not software.

The technologies used, languages used etc, are nothing to do with this. Bad vs good developers, nothing to do with it. Any half decent programmer can make a piece of code run faster, be more responsive, be the ultimate it could. My experience is decent programmers don't bankrupt the business when left to make the decisions, while half decent ones complain how much "better" it "should" be.

share|improve this answer
2  
My iPhone numbers are not exaggeration; I got them by counting the seconds out loud while using my own phone. There is a humorous (if less extreme) depiction of this issue at youtube.com/watch?v=Pdk2cJpSXLg . Also, my phone was fine when I bought it! I evaluated performance carefully when choosing phones. But it became slower and slower with each successive firmware update from Apple, to the point of unusability. I suppose it might be my fault for installing Apple's updates. – Crashworks Jun 22 '11 at 0:32
I blame the programmers to a large extent - I see commercial apps all the time with bugs and horrible use case analysis that no developer with any competence or pride in their work would ever release, regardless of who they're workng for - these people are a disgrace to our profession. – Mikey Sep 26 '11 at 2:57

Your DVR takes that long to change channels because it has to first dump the buffered data, and then queue up another buffer full of data for the new channel you are watching. This buffer is most likely stored on the hard drive so these operations take time (plus it can only fill the buffer in real time). With a DVR you are never watching "live" programming, it is always delayed (not coincidentally, it is delayed by the same time as your perceived delay when switching channels). This can easily be verified by watching a sports program at the same time that you listen to it on a radio.

share|improve this answer
This isn't quite what I was referring to -- my problem with my DVR is that it takes several seconds to show any response to any operation, even those inside its menus. For example, if I am navigating through its main menu (not watching a show), and I push DOWN on the remote, then it takes several seconds before the onscreen highlight moves down by one item. If I hit 'pause' while watching a show, there's a five second lag before it pauses. When I go to program a recording and page up and down in the guide, every button push takes many seconds to register and change the display. – Crashworks Jun 22 '11 at 2:13
I disagree with this statement. Having just switched from AT&T Uverse to Comcast, I have found that the DVR for Comcast is incredibly slow compared to the Uverse box. That may be a reason for a delay, but that doesn't mean that it will be the only reason that the box is slow. – Jetti Jun 22 '11 at 12:41

I think the reason is that most consumer directed apps are controlled and marketed by people who don't know anything about software, and hire developers based on their resumes or the recommendations of some no-nothing manager, as opposed to their actual skills and knowledge.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.