Geek Pride
2003-08-01 00:05Imagine a cartoon. One character reaches into the mouth of another. The arm goes in to the shoulder, they grab hold of something, and PULL the victim inside-out.
I did that to a computer program today - a big forest of nested if-then-elses, 3-4 layers deep. This code gets executed at least 10+ times whenever someone loads a page from the system, and is almost guaranteed to be a performance bottleneck as soon as we get above about 20 simultaneous users.
By the time I was done, 412 loooong lines of code had been reduced to 165 shorter lines, it's faster to execute, and I'm within striking distance of (1) sharing huge slabs of code with another, very similar, function and (2) replacing dozens of string comparisons with an integer-based switch/case.
I appreciate that a large proportion of my readers would understand the above better if it was written in Martian, but I reckon that's a good afternoon's work.
Of course, when I go in tomorrow, I'm likely to find that the overnight build has exploded in flames, and no doubt in three weeks' time we'll find some hideous bug I caused in the process, but...
I did that to a computer program today - a big forest of nested if-then-elses, 3-4 layers deep. This code gets executed at least 10+ times whenever someone loads a page from the system, and is almost guaranteed to be a performance bottleneck as soon as we get above about 20 simultaneous users.
By the time I was done, 412 loooong lines of code had been reduced to 165 shorter lines, it's faster to execute, and I'm within striking distance of (1) sharing huge slabs of code with another, very similar, function and (2) replacing dozens of string comparisons with an integer-based switch/case.
I appreciate that a large proportion of my readers would understand the above better if it was written in Martian, but I reckon that's a good afternoon's work.
Of course, when I go in tomorrow, I'm likely to find that the overnight build has exploded in flames, and no doubt in three weeks' time we'll find some hideous bug I caused in the process, but...
no subject
Date: 2003-07-31 16:49 (UTC)Then the US wing of the company got to work modifying the system for the American market. Some manager noticed that the UK team hadn't been quite as aggressive as they might have been with the use of the sign bit in one of the registers, and fired off a really harsh memo to higher management on both sides of the Atlantic, slating the UK team for this oversight. This obscenely wasteful squandering of valuable bits was duly `corrected', and the system installed in a test car and sent off round the track.
I'm told that everything was fine up to 127 mph, at which point the car promptly flipped over on its back in a rather spectacular and aggravating manner - having abruptly decided that it was now travelling 128 mph in reverse.
nicholas