Posts Tagged ‘time’

Clock Ticks per Lifetime

April 12, 2010 Leave a comment

Okay, so this is a slightly random thought, but I was thinking about clock ticks. And that led to an oddly profound thought, which I’ll share in a minute.

As an engineer, perfectionist, and anal-retentive type of guy, I’m constantly measuring, analyzing, and trying to optimize everything to death.

I am a geek’s geek. The type of geek that is better kept in the basement, the kind you’d be afraid to get too close to a real life customer. I think hacking around reading the Linux kernel source code is fun.

Anyways, part of my job as a software engineer is to “profile” code. I use various nifty tools and gizmos combined with manual instrumentation and analysis to find the slowest/most time-consuming parts of a software project — and then make them faster. Usually, it’s not too tricky to find the worst part, and most of the time it’s not too difficult to make the slowest part faster — it’s generally much harder to work on the right peice of code for the right amount of time.

It’s a lot easier to get lost in optimizing the wrong part of the code, the code you want to fix even though it only impacts 5% of the total runtime. You can spend a week making your program start 10% faster, and not realize that nobody flippin’ cares if your program starts in 2.1 seconds instead of 2.35.

There are other times when you completely miss an important clue, the alarm bells are ringing like crazy and the red flags are going nuts – but you (or someone you know) is asleep at the wheel. The lights are on, but nobody’s home… and you don’t optimize a small but critical piece of code. The reasons this happens are as varied as the seasons, but one common malady is lack of context. The Foo module only takes 749 us (and Bar takes 200 ms), but you don’t realize that Foo runs in a tight loop and is the critical path. So you waste time and money “fixing” Bar and wonder why your software is buggy and slow.

It’s these little contextual clues that make all the difference. These key vital bits of information that provide a frame of reference and give shape to a project.

A good analogy that comes to mind are the corner peices in a puzzle. One of the first things a kid learns about puzzles is that putting the corner pieces in place makes everything just flow together. Trying to build a puzzle without the corners (or sides) is much more difficult. There’s no framework to base the rest of the puzzle on, no structure to latch onto.

Getting to the point of this rambling story, I had a minor epiphany of sorts when thinking tonight about clock ticks. It wasn’t really a corner piece, maybe just a small side of the puzzle that I snapped into place. But I wanted to share it here in case anyone else finds it interesting.

I was thinking about processor clock ticks, and started to do a little math. Common processor clock speeds are in the GHz range, let’s pick 2.66 GHz just for fun. Let’s pretend you’re a respectable geek and you have a Core i7 system which you haven’t overclocked, it’s running at the stock 2.66 GHz clock.

2.66 GHz is a lot of hertz. How many hertz? Well, a gigahertz is a billion cycles per second, so 2.66 GHz is 2.66 times a billion cycles/second.

That means your Core i7 processor has a clock period of

1/(2.66*10^9) sec =~ 375 picoseconds

375 picoseconds is not a lot of time. It happens 2.66 billion times every second, which is amazing because your Core i7 is getting something done every few clock ticks – for simplicity’s sake, let’s say your CPU gets a billion something’s done every second.

That is pretty neat, and totally geeks me out – but it made me think and wonder about how that relates to people. Assuming the average life expectancy is, say, 70 years, how many “clock ticks” do we get in our lifetime?

Drumroll to cue in some more math…

(2.66*10^9 Hz) * (3600 sec/hour) * (24 hours/day) * 
(365.26 days/year) * (70 years/lifetime) = 5.876186 × 10^18

That is a lot of clock ticks.

So, if you’re still with me, and the tedious algebra didn’t send you running for safety – the thought struck me that maybe, just maybe, with approximately 6 x 10^18 clock ticks in my life, I have enough time.

There’s enough spare clock cycles for me to not be a complete perfectionist, to live a little and make mistakes. To learn from those mistakes, and make other stupid mistakes to learn from.

With 6 x 10^18 clock cycles (of which I have at least 3.5 remaining), there’s enough time to relax and enjoy my job, family, church, and life. To not waste time, but choose instead to live it more fully and purposefully.

So the next time someone like me is stressing about some peice of code that doesn’t matter, or stressing over little details that aren’t 100 percent relevant – tell them to relax and burn a few clock ticks being human.

There are enough clock ticks in your life to get everything done, and have fun in the process.



Categories: Epiphany Tags: , , ,