Eric had not expected to be put into this position. He had been an annual visitor to Comicon for the past decade, but when they ran into trouble with the audio right before the "Big Bang Theory" cast panel, he just happened to be the right person in the right place at the right time. Working furiously to get the cabling back together, he was surprised the gentle tap on his shoulder. Turning around, he found himself face-to-face with Kaley Cuoco.

"Thanks soooo much for your help", she cooed.

"N-N-No problem", Eric stuttered. "Happy to be able to help out"

Turning back to the console, Eric refocused. Was that a hand he still felt resting lightly on his back?

And that faint music. Getting lounder. It was almost...no, it was the sound of the Barenaked Ladiea.

Groggily, Eric rolled over in his bed and reached for the cell phone that was ringing on the night stand.

"Yeah?"

"Eric, it's Trevor. We've been running into a problem since that patch to the exporting program was put in over the weekend. It has been slowly getting worse over the weekend, but now that Europe is starting to come on-line, it's become an emergency."

An emergency, thought Eric? Yeah, sure. Then why wasn't it an emergency yesterday evening.

Still Eric went over to his desk, flipped on his computer and started digging. Naturally, the first place to look was where stuff had just been changed.

When not saving geek conferences, Eric worked for a phone company that keeps custom audio from their customers in giant wave files. And for him, 'giant' meant around 200-700MB. These wave files contained custom prompts created by their customers in an audio format. Associated with each of these wave files is a text file containing metadata about the number and content of the prompts encoded in the audio format.

When a wave file was imported into the application, it would break the wave file into a large number of 20MB chunks. These chunks were easier to manage (not to mention being able to ZIP up and send around by email, if needed). The file names related to these chunks were included in the text-based metadata. On export, the metadata file would be read, the chunks located and put back together into one big file.

However, thanks to a change in the export process, the 'de-chunkifying' was taking much longer than before. When one told the program to export, it would hang for about eight seconds, and then pop up a progress bar and chug away for about four more seconds. And the only change seemed to be the addition of that progress bar. Putting aside the WTF-ness of waiting two-thirds of the way into a process to even start the progress bar, the timing seemed odd to Eric.

Seeing no other significant modifications, Eric drilled into the code surrounding the progress bar. The import was split into three steps. First it loads the audio metadata from the text file. Next it uses a function to check the total sizes of the audio 'chunks' (to more accurately inform the user of the progress). Finally, the progress bar was displayed and the exported file created. Thinking it was strange that the first two parts took 8 seconds while the real work took only four, Eric went further into the code.

What he saw was that the time before the progress bar was spent almost entirely in the function checking the file sizes. Now knowing where to look, Eric quickly scanned through the file sizing code. As it turns out, rather than measuring the file size, it was measuring the audio size. Which required it to open, read, and process the header of each and every 20MB wave file.

Given the criticalness of the accuracy of the progress bar (yes, he was familiar with how precise Microsoft always got with their progress indicators), Eric altered the progress bar procedure to use the number of chunks in the text file rather than the combined size of the audio chunks as it's metric. All of a sudden, the progress bar was almost instantaneously available and the entire exporting process took 4 seconds. Looking a little further into the code, he discovered that the updates to the progress bar were being made with ever 200B read from the file. By increasing that to 4MB he cut another 3 seconds off the process. Yes, yes the cost was less accuracy. Sue him.

Eric pushed the changes into the master branch and relaxed back into his chair while waiting for the build to run.

"Oh Eric,", said Kaley as she leaned closer, "you're soooo awesome." The kiss was soft and moist.

The ping of an incoming notification brought Eric back to consciousness. And the only blonde in sight was the cocker spaniel licking drool off of his face.

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!