blufive: (Default)
[personal profile] blufive
Imagine 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...

Profile

blufive: (Default)
blufive

April 2024

S M T W T F S
 123456
78910111213
14151617181920
21222324252627
282930    

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated 2026-03-23 11:16
Powered by Dreamwidth Studios