4 ms·
Physician, heal thyself. It always seemed evident to me that Knuth's exhortation was about making sure that the thing you were optimized was in fact a major co
by syntheticnature 12y ago
Physician, heal thyself.
It always seemed evident to me that Knuth's exhortation was about making sure that the thing you were optimized was in fact a major contributor of code time usage -- and that your change was an improvement.
Telling people to avoid, for example, bounds checking because it might turn out to be a cycle soak later sounds like a good way to make your software worse, not better, in the hopes that a few instructions saved will make the difference. I once worked on a code base once with three different half-right hand-hacked versions of date formatting code. I replaced them with strftime(). Certainly the call was slower, but I was provably better off optimizing the timer routine that ran 50 times a second than worrying about hand-formatting dates into strings.
- thaumaturgy 12y agoI think the principle of charity that dang has recently been trying to promote applies here. It's probably safe to assume that the author isn't suggesting that software be allowed to critically fail more often in the interests of micro-optimization. The PDF he linked to for bounds-checking is a series of slides that notes that conventional approaches to bounds-checking incurs a 60% runtime performance hit, and that there is another approach that works as well but incurs only about a 23% runtime performance hit. Aside: rapidly improving energy efficiency has probably been one of the greatest technological developments of the last 20 years; it would be amazing if software development practices could be similarly adapted. Like, is it possible to have a demoscene approach to software development while still keeping portability and maintainability? Imagine the transformation in software we could see in the next 10 years if someone figured out how to do that.
- jacquesm 12y agoMobile battery life might be just the thing that pushes this over the critical point. The first party to create a smartphone with a four week battery life because they made their (tightly integrated) system work on a 5 Mhz cpu will make a lot of money.
- com2kid 12y agoSmart phones have poor battery life due to background data sync (radios are expensive to power up) and screen usage. Turn airplane mode on, leave your screen off, and your phone will last a long time.
- marvy 12y agoAirplane mode is not fair. After all, "dumb" phones last for many days even without airplane mode, as long as you don't over use them. The fair test is this: how long will it last when used as if it were a dumb phone. Answer: pretty good, but much less than an actual dumb phone.
- ryanbrunner 12y agoDumb phones typically don't need to use their radio to do things like check mail though.
- marvy 12y agoThat's because they typically don't check mail, at least not in the background. That's fine. Turn off the mail check feature of the smart phone. Now will it last as long as the dumb one? Not quite. I would know, since I do have that feature turned off. As well as location tracking.
- deleted 12y ago[deleted]
- com2kid 12y agoSmart phones have poor battery life due to background data sync (radios are expensive to power up) and screen usage. Turn airplane mode on, leave your screen off, and your phone will last a long time.