• Andy (unregistered)

    It's -131,072 .

    Captcha: ATARI ... Appropriate

  • emh (unregistered) in reply to Andy
    Andy:
    It's -131,072 .

    Captcha: ATARI ... Appropriate

    Not in ones-complement.

  • Andy (unregistered)

    Oops I guess I skipped over the part where it says "one's" in the article : )

    CAPTCHA: Doom ... I guess I'm doomed into shame now.

  • (cs)

    I often forget my too

  • Maks Verver (unregistered)

    I thinkt he number after 131071 should be -131071 not -0. -0 would be all ones; the last value before the register wraps around.

    One's complement is almost like two's complement, only negative numbers are off by one. The ordering is the same. (You would get -0 in signed magnitude notation though, but then the next number would be -1).

  • Duston (unregistered)

    I heard or read somewhere about how programmers need to be careful when they about "faster." To show their point, they asked the question, "Which is faster, cooking something in the microwave for 1:10 or 1:11?" Of course any idiot would say "1:10", but the real answer is that in the human interaction portion of the activity (i.e. pushing the buttons), 1:11 is faster because it's faster (i.e., easier) to type in three 1's on the keypad than 1:10.

    I thought it was interesting...maybe you had to be there.

  • [email protected] (unregistered)
    In the scope of his overall solutions, optimizing like this was like turning down the radio in a Hummer to improve gas mileage. And even if that analogy could work back in those pre-Hummer days, the Star Programmer would just shake his head and disagree. To him, every nanosecond was precious and must be saved.

    Awesome analogy.

  • (cs)

    I could swear I've read this WTF before. Was it posted in the Sidebar first?

  • TGV (unregistered) in reply to Duston

    OMG (another site name with a great profit potential), the thing about 1:10 vs 1:11 is such a silly example of the frame problem, I cannot begin to fathom the nerdiness of these guys. And I think I can type 110 just as fast as 111, perhaps even faster since there's no need to wait for your finger to release the second one before pressing the 0. Ha! Take that, nerds. Mmm, can any of you tell I studied amongst some great nerds?

    And 131.071 + 1 = -131.071 indeed.

    By the way, WTF is up with the forum software? I tried to "Sign in" and got an IIS error page...

  • (cs)

    So he didn't see the obvious fix?

    Add a couple of assembly instructions equivalent to 'if (counter < 0) counter = 0' (or 1000 or whatever would make it not be a rarely used program).

  • (cs) in reply to Skybert
    Skybert:
    So he didn't see the obvious fix?

    Add a couple of assembly instructions equivalent to 'if (counter < 0) counter = 0' (or 1000 or whatever would make it not be a rarely used program).

    I think that would've used too many of his precious cycles.

    /sarcasm

  • Applepear (unregistered) in reply to Duston
    Duston:
    I heard or read somewhere about how programmers need to be careful when they about "faster." To show their point, they asked the question, "Which is faster, cooking something in the microwave for 1:10 or 1:11?" Of course any idiot would say "1:10", but the real answer is that in the human interaction portion of the activity (i.e. pushing the buttons), 1:11 is faster because it's faster (i.e., easier) to type in three 1's on the keypad than 1:10.

    I thought it was interesting...maybe you had to be there.

    I actually enter times like 1:11, 2:22, 3:33 into the microwave. Mainly to be lazy rather than fast.

  • (cs) in reply to Duston
    Duston:
    I heard or read somewhere about how programmers need to be careful when they about "faster." To show their point, they asked the question, "Which is faster, cooking something in the microwave for 1:10 or 1:11?" Of course any idiot would say "1:10", but the real answer is that in the human interaction portion of the activity (i.e. pushing the buttons), 1:11 is faster because it's faster (i.e., easier) to type in three 1's on the keypad than 1:10.

    I thought it was interesting...maybe you had to be there.

    The problem as stated here isn't if you can press the buttons faster, it is whether it cooks faster. I say it cooks just as fast in either case, but adding more time might overcook it.

    Let me restate it like this and see what you think, because the numbers are scalable. Will it cook faster if you leave it in the oven for one minute or one week? The speed at which it cooks doesn't change, the problem is if you are cooking longer than necessary.

    This actually shows a different problem. We are trying to solve the wrong problem, which brings us right back to the original post.

  • jbinaz (unregistered) in reply to Duston

    When I need to cook something for 1:30, I enter :90 instead. One less keystroke.

    jbinaz

  • muburned (unregistered) in reply to KattMan
    KattMan:
    Let me restate it like this and see what you think, because the numbers are scalable. Will it cook faster if you leave it in the oven for one minute or one week? The speed at which it cooks doesn't change, the problem is if you are cooking longer than necessary.
    But the laws of physics cease to exist over his stove while he's cooking his grits.
  • (cs)

    I guess the solution of this story is either he choose to live with the problem and turned his math down to unsigned 17bit, then he could save an entire bit per calculation and still keep a cap of 131,072 or he choose the more sane thing, turn his 18bit math to unsigned, and now it will take twice as long for Fortran to bomb out.

    I guess the world will never know!

  • dkf (unregistered)

    Heh. A perfect demonstration of the two Rules of Optimization:

    1: Don't do it. 2 (for experts only): Don't do it (yet).

  • my name is missing (unregistered) in reply to TGV
    TGV:

    By the way, WTF is up with the forum software? I tried to "Sign in" and got an IIS error page...

    IIS is a WTF.

    CAPTCHA = ewww

    even the software thinks so

  • (cs) in reply to muburned
    muburned:
    KattMan:
    Let me restate it like this and see what you think, because the numbers are scalable. Will it cook faster if you leave it in the oven for one minute or one week? The speed at which it cooks doesn't change, the problem is if you are cooking longer than necessary.
    But the laws of physics cease to exist over his stove while he's cooking his grits.
    Was the OP My Cousin Vinny?
  • Rich (unregistered)

    While I read this I thought that Mel came back for a new job. http://www.wizzy.com/andyr/Mel.html

  • Thras (unregistered)

    No one has suggested that it should have been coded in Ruby instead?

  • (cs) in reply to Duston
    Duston:
    I heard or read somewhere about how programmers need to be careful when they about "faster." To show their point, they asked the question, "Which is faster, cooking something in the microwave for 1:10 or 1:11?" Of course any idiot would say "1:10", but the real answer is that in the human interaction portion of the activity (i.e. pushing the buttons), 1:11 is faster because it's faster (i.e., easier) to type in three 1's on the keypad than 1:10.

    I thought it was interesting...maybe you had to be there.

    Disagree:

    1. The question, as you wrote it, refers to cooking time specifically, not preparation time.

    2. I can put one finger on "1" key and one finger on "0" key. The instant my first finger has activated the circuit of the "1" key, I can then press the "0" key with the other finger. If I used the same first finger to press "1" AGAIN then it would take longer since time is wasted as your finger bounces up from pressing the key.

    3. I can just press "Minute Plus" quick-key on my microwave twice and it starts cooking already :)

  • lordtang (unregistered)

    Seems like a wtf to consider run counts as something worth calculating how often a program is run -- unless it gets reset at a given time interval.

    Say FORTRAN went out of style (heaven forbid).. is it's run count still "above" 131,071? I'd hate to see it wasting space on disk at the mentioned facility. (I think it's my hosting company)

  • Eric76 (unregistered) in reply to jbinaz
    jbinaz:
    When I need to cook something for 1:30, I enter :90 instead. One less keystroke.

    jbinaz

    When I first got a microwave in 1982 or so, I thought that you entered the time in seconds, which was fine by me. I was kind of surprised because I knew plenty of people who might have trouble converting from minutes and seconds. I guess I assumed it was in seconds because if you entered 90 seconds for a minute and a half, it cooked for the full 90 seconds.

    I liked how it worked for anything taking less than a minute and a half, but for things that took longer, it seemed to undercook the food. The longer the time, the more undercooked. I remember going and buying a tv dinner, entering the cooking time in seconds (probably about 6 minutes or 420 seconds), and it wasn't ready at all when I got done.

    After a few weeks of undercooked food and of thinking that Sears was selling defective microwaves, I was watching it one night when the timer went from 100 to 59 seconds in one second.

    To my way of thinking, if it was minutes and seconds, it should have given an error message if you entered 0060 instead of 0100.

  • Eric (unregistered)

    According to wikipedia, using ones complement it would go directly to -131,071 and -0 would occur right before 0. http://en.wikipedia.org/wiki/Ones_complement

  • (cs) in reply to Rich
    Rich:
    While I read this I thought that Mel came back for a new job. http://www.wizzy.com/andyr/Mel.html

    Except Mel actually sounds like a somewhat reasonable programmer for the time.

    I love that story BTW.

  • Eric76 (unregistered) in reply to Eric76
    Eric76:
    jbinaz:
    When I need to cook something for 1:30, I enter :90 instead. One less keystroke.

    jbinaz

    When I first got a microwave in 1982 or so, I thought that you entered the time in seconds, which was fine by me. I was kind of surprised because I knew plenty of people who might have trouble converting from minutes and seconds. I guess I assumed it was in seconds because if you entered 90 seconds for a minute and a half, it cooked for the full 90 seconds.

    I liked how it worked for anything taking less than a minute and a half, but for things that took longer, it seemed to undercook the food. The longer the time, the more undercooked. I remember going and buying a tv dinner, entering the cooking time in seconds (probably about 6 minutes or 420 seconds), and it wasn't ready at all when I got done.

    After a few weeks of undercooked food and of thinking that Sears was selling defective microwaves, I was watching it one night when the timer went from 100 to 59 seconds in one second.

    To my way of thinking, if it was minutes and seconds, it should have given an error message if you entered 0060 instead of 0100.

    Oops. That should have been 7 minutes or 420 seconds.

  • Krenn (unregistered) in reply to Eric76
    Eric76:
    After a few weeks of undercooked food and of thinking that Sears was selling defective microwaves, I was watching it one night when the timer went from 100 to 59 seconds in one second.

    To my way of thinking, if it was minutes and seconds, it should have given an error message if you entered 0060 instead of 0100.

    Just wondering - do you remember if it had a colon between the minutes and seconds? Another optimization - "the colon is understood, so we'll leave it out".

    Also, you don't want the microwave displaying errors unless there's something really wrong and it's completely dead; the error message will be far more confusing than not. (especially since the LED was just 7 pieces, so it would show "E01")

  • MagikSlinger (unregistered)

    Oh dear ghu! I knew people like that back when I worked in the video game industry, and no matter how hard you should them their optimizations did not save anyone cycles, bytes or development time, they would insist that what was true on a Z80 20 years ago was still true on an R/3000 in 1999. (>_<;)

    Before I started working the game industry, I was en route to becoming like the Optimizer there, but thankfully working with a company full of people like that when I was in Tools & Library quickly amended my ways.

  • mabinogi (unregistered) in reply to Pap
    Pap:
    Duston:
    ..."Which is faster, cooking something in the microwave for 1:10 or 1:11?"...

    Disagree:

    1. The question, as you wrote it, refers to cooking time specifically, not preparation time.

    2. I can put one finger on "1" key and one finger on "0" key. The instant my first finger has activated the circuit of the "1" key, I can then press the "0" key with the other finger. If I used the same first finger to press "1" AGAIN then it would take longer since time is wasted as your finger bounces up from pressing the key.

    3. I can just press "Minute Plus" quick-key on my microwave twice and it starts cooking already :)

    1). You didn't actually read what he said. He said "which is faster", not "which cooks faster". It does not refer specifically to cooking time at all.

    2 + 3). You're willfully missing the point in an attempt at either pedantry or humour

  • dkf (unregistered) in reply to Krenn
    Krenn:
    Also, you don't want the microwave displaying errors unless there's something really wrong and it's completely dead; the error message will be far more confusing than not. (especially since the LED was just 7 pieces, so it would show "E01")
    These days that's solved by using fancier displays (so they can render letters better) and scrolling the message. On the other hand, there will probably be buttons for adding to the cooking time which mean that hardly anyone tries doing more than 59 seconds using the seconds-entering mechanism.
  • (cs)

    Re: http://www.wizzy.com/andyr/Mel.html

    That's not a WTF at all. That is beautiful and poetic. Mel is my new hero. Optimization as an art-form.

    /sighs as he gets back to his ugly, slow Visual Studio code

  • Anonymous Coward (unregistered) in reply to Pap

    3) I can just press "Minute Plus" quick-key on my microwave twice and it starts cooking already :)

    Even faster, just press "2" on my microwave for 2 minutes (1->9 and the 30sec button all do this) and it starts right up.

  • Jonathan Morton (unregistered)

    Microwaves have several different input systems for the time. Here are some examples I've seen:

    • Clockwork dial. This doesn't have enough precision to distinguish between 1:10 and 1:11, but it's pretty fast to use if you're experienced.

    • Separate increment buttons for 10 minutes, 1 minute and 10 seconds. Again, this doesn't allow for the possibility of 1:11, but you only have to press two buttons anyway to get 1:10.

    • I haven't actually seen the "keypad dial" on a microwave. Hmm...

    • Digital dial. Like the clockwork dial, this allows for rapid and intuitive input, but with better accuracy and precision. Mine counts in larger steps for larger amounts of time, so the choice is actually between 1:00 and 1:15. (Personally, I don't think that's enough precision. - and by the time you get to 8 minutes, it counts in whole minutes.)

    Whichever you choose, frobbing the knob takes less time than subsequently moving from the knob to the "Start" button. In one case, the digital knob was actually recessed, so you had to first extract the knob before using it, and put it back afterwards.

  • anon (unregistered)
    Alex Papadimoulis:
    They eventually realized that, not only could make as much money per hour at the local Arby’s Restaurant, but that they’d also get free meals there. So they quit en masse. Only then did management realize there might be a technical problem.
    I don't get it.... While nobody's leaving, management thinks it's just a busy time. When people all leave, management thinks it's a technical issue. WTF?
  • Martin (unregistered) in reply to anon

    Simple, once people left en masse the management had to mount the tapes. As long as it's some flunky doing the work, it's not a problem.

  • vern (unregistered) in reply to mabinogi
    mabinogi:
    Duston:
    ..."Which is faster, cooking something in the microwave for 1:10 or 1:11?"...
    1). You didn't actually read what he said. He said "which is faster", not "which cooks faster". It does not refer specifically to cooking time at all.
    While I'm not the person you were responding to, I'd like to take a moment to point out that the time savings involved in pushing 1-1-1-START is lost in the extra second of cooking, so 1-1-0-START still wins. Even faster still is 7-0-START. :P
  • Some Random Microwave Jockey (unregistered) in reply to Duston

    This only works if it takes you longer than one full second to transition from the 1 key to the 0 key. If anyone actually does take that long, I'd have serious doubts about their hand-eye co-ordination, and for that matter, their ability to interact with the modern world.

  • (cs) in reply to KattMan
    KattMan:
    Duston:
    I heard or read somewhere about how programmers need to be careful when they about "faster." To show their point, they asked the question, "Which is faster, cooking something in the microwave for 1:10 or 1:11?" Of course any idiot would say "1:10", but the real answer is that in the human interaction portion of the activity (i.e. pushing the buttons), 1:11 is faster because it's faster (i.e., easier) to type in three 1's on the keypad than 1:10.

    I thought it was interesting...maybe you had to be there.

    The problem as stated here isn't if you can press the buttons faster, it is whether it cooks faster. I say it cooks just as fast in either case, but adding more time might overcook it.

    Let me restate it like this and see what you think, because the numbers are scalable. Will it cook faster if you leave it in the oven for one minute or one week? The speed at which it cooks doesn't change, the problem is if you are cooking longer than necessary.

    This actually shows a different problem. We are trying to solve the wrong problem, which brings us right back to the original post.

    Cooking something in the microwave involves typing in how long you want it to cook for.

  • Jon (unregistered) in reply to Some Random Microwave Jockey
    Some Random Microwave Jockey:
    This only works if it takes you longer than one full second to transition from the 1 key to the 0 key. If anyone actually does take that long, I'd have serious doubts about their hand-eye co-ordination, and for that matter, their ability to interact with the modern world.
    I was thinking the same thing. Even if you account for the occasional error, it ought to be less than a full second on average.
  • Steve (unregistered) in reply to jbinaz

    When I need to cook something for 1:30, I enter :90 instead. >>One less keystroke. Try entering 99. The 1:30 is just an approximation, and 99 keys in faster than 90. :)

  • non-conformist (unregistered) in reply to jbinaz
    jbinaz:
    When I need to cook something for 1:30, I enter :90 instead. One less keystroke.

    jbinaz

    Yes but do you use base 2, 8, 10 or 16 to do so?

  • non-conformist (unregistered) in reply to travisowens
    travisowens:
    I guess the solution of this story is either he choose to live with the problem and turned his math down to unsigned 17bit, then he could save an entire bit per calculation and still keep a cap of 131,072 or he choose the more sane thing, turn his 18bit math to unsigned, and now it will take twice as long for Fortran to bomb out.

    I guess the world will never know!

    <Nitpick> "FORTRAN" did not bomb out; it was the program-launcher (i.e.: RUNPROG) that caused the interminable delay </Nitpick>

  • Coyne (unregistered) in reply to travisowens
    travisowens:
    I guess the solution of this story is either he choose to live with the problem and turned his math down to unsigned 17bit, then he could save an entire bit per calculation and still keep a cap of 131,072 or he choose the more sane thing, turn his 18bit math to unsigned, and now it will take twice as long for Fortran to bomb out.

    Except that the CDC didn't have unsigned 18-bit math. He'd have had to actually work to do that.

    And, of course, adding a test to prevent the number from wrapping at 131071 (i.e., leave it at 131071) would have taken an additional 3 whole instructions, at least. Can't waste all that time checking for something that only happens every 131,071 times.

    (Especially since it happens only for ONE program. And who cares about operators anyway?)

    BTW, the addition would have wrapped directly from +131071 to -131071. CDC was true ones-complement, not sign-magnitude, so since +131071 is 0x1FFFF then -131071 is 0x20000 (rather than 0x3FFFF). The rollover would have happened like this:

       0x1FFFF + 1 ===> 0x20000 
    
    
    

    So there wouldn't be an intermediate stop at -0. (Isn't ones-complement math cool?)

    CDC, as noted, did have a technical negative zero (0x3FFFF) but this couldn't be obtained as a result from any mathematical operation and was treated as identical to +0 in any operation.

  • GettingJaded (unregistered)

    Somehow, I knew the solution would be resetting the counter...

    Treating the symptoms and not the cause...this site is getting to me.

  • csrster (unregistered) in reply to joe.edwards
    muburned:
    KattMan:
    Let me restate it like this and see what you think, because the numbers are scalable. Will it cook faster if you leave it in the oven for one minute or one week? The speed at which it cooks doesn't change, the problem is if you are cooking longer than necessary.
    But the laws of physics cease to exist over his stove while he's cooking his grits.
    Was the OP My Cousin Vinny?

    Ok, I'm through wid' dis guy.

  • [ICR] (unregistered) in reply to Some Random Microwave Jockey
    Some Random Microwave Jockey:
    This only works if it takes you longer than one full second to transition from the 1 key to the 0 key. If anyone actually does take that long, I'd have serious doubts about their hand-eye co-ordination, and for that matter, their ability to interact with the modern world.

    The point of the joke is that while it cooks for 1 second more, you are free to go do something else. You have put less effort into entering in the number for the nominal fee of having to wait a whole extra second for the food to cook. This parallels optimising code. You can put all that work in to optimise and only use 18-bit maths to save a few nanoseconds, but you'll have to keep coming back to fix problems.

    It's not about saving overall time, it's about the trade-off between what you have to do to get things rolling and how long you have to wait for it to roll.

  • (cs) in reply to Duston
    Duston:
    I heard or read somewhere about how programmers need to be careful when they about "faster." To show their point, they asked the question, "Which is faster, cooking something in the microwave for 1:10 or 1:11?" Of course any idiot would say "1:10", but the real answer is that in the human interaction portion of the activity (i.e. pushing the buttons), 1:11 is faster because it's faster (i.e., easier) to type in three 1's on the keypad than 1:10.

    I thought it was interesting...maybe you had to be there.

    My microwave has buttons for 1h, 10min, 1min and 10sec. So to get 1hour 10, I have to press two buttons, not three. Therefore it's quicker for me to cook 1 hour 10 (or 1 min 10 secs, especially as I have no 1 sec button, so would have to overshoot to 1 min 20 and cancel).

  • (cs) in reply to Jonathan Morton
    Jonathan Morton:
    Microwaves have several different input systems for the time. Here are some examples I've seen:
    • Clockwork dial. This doesn't have enough precision to distinguish between 1:10 and 1:11, but it's pretty fast to use if you're experienced.

    • Separate increment buttons for 10 minutes, 1 minute and 10 seconds. Again, this doesn't allow for the possibility of 1:11, but you only have to press two buttons anyway to get 1:10.

    • I haven't actually seen the "keypad dial" on a microwave. Hmm...

    • Digital dial. Like the clockwork dial, this allows for rapid and intuitive input, but with better accuracy and precision. Mine counts in larger steps for larger amounts of time, so the choice is actually between 1:00 and 1:15. (Personally, I don't think that's enough precision. - and by the time you get to 8 minutes, it counts in whole minutes.)

    Whichever you choose, frobbing the knob takes less time than subsequently moving from the knob to the "Start" button. In one case, the digital knob was actually recessed, so you had to first extract the knob before using it, and put it back afterwards.

    I have seen a microwave with a digital keypad, my parents bought it. They chose it because it was large enough to fit an entire loaf of bread and turn it (apparently).

    I also have the world's most annoying microwave at my place, it has an analogue dial, with no start button (it starts as soon as you turn the dial). Thing is, the dial is slightly loose so it has an accuracy of about 15 seconds, the scale is in minutes, and after 10 minutes it's in 5 minutes (with even worse accuracy). I'm not sure how they did that. Trying to cook anything for under a minute is impossible to do accurately, and one kind of microwave meal I sometimes get needs to be cooked for "10 1/2 minutes". The difference between 10 and 11 minutes is less than the wobble in the dial...

    I've seen one on holiday once that was sensible though. The "power" dial was marked in Watts, so if the instructions said "4 minutes at 650W" you set it to 650W and cooked it for 4 minutes :)

  • Blame (unregistered)

    1: Profile. 2: Optimise.

Leave a comment on “Saving a Few Nanoseconds ”

Log In or post as a guest

Replying to comment #:

« Return to Article