Bike to Work 2012

I meant to post this last month…

For years I’ve meant to participate in Bike to Work day. That distance for me isnt’ that long (about 35 miles one way) but there is the small matter of having to cross the Santa Cruz Mountains to get from the Santa Cruz area over to Silicon Valley. And of course, doing it again at night to get back home!

This year I decided to go for it (I’m signed up for the Levi’s GranFondo in September, so need to start getting some training mileage in!). Going to work wasn’t bad at all, I’m used to climbing Mt. Charlie and from the summit the rest of the way was all down hill or flat! Easy ride. I could do this often!

Coming back home was a lot tougher. When I got to Lexington Reservoir I had already done about 50 miles that day and was starting to get tired but all the climbing was still ahead of me! By the time I got to the summit I was beat and it was completely dark. Fortunately I had borrowed some powerful bike lights from my neighbor so I had plenty of illumination.

All in all it was fun, I should do this more often. Here is the data from my bike stats and also on strava.

 

Bloom filter vs. CPU cache

I was playing around with a bloom filter today and drawing some graphs on performance vs. various metrics. While for my real use case the filter bit array is larger, just for fun I wanted to look at how the performance changes as the array size exceeds various CPU caches.

I’m running on an AMD Phenom II X4 925 Processor which has 64K L1 cache (per core), 512K L2 cache (per core) and 6MB L3 cache (shared). The bloom filter code is single threaded.

The following graph shows the time (yellow line) taken to insert 10 million entries into the bloom filter as the size of the bit array (red line) increases linearly (the two lines are not on the same y-axis scale). For the first two-thirds of the graph the time taken is just over 2 seconds, or just under 5 million elements per second. The sudden change in the slope of the line is near 512K at which point the array no longer fits the L2 cache.

The next graph zooms out to show the size of the bit array increasing all the way to 18MB. The second slope change (about a third of the way from the left)  is in the neighborhood of 6MB, corresponding to the L3 cache size.