Andrew Que Sites list Photos
Projects Contact

June 29, 2018

860 miles for June

   Today marks the last ride of the month.  Temperatures on the ride home were above 90°F/32°C with humidity around 60% and are expected to stay this way through the weekend.  My body is exhausted and I think it is fair to say this is enough for now.
   The finial tally: 860.79 miles.  25 of 30 days ridden with an average of 34.4 miles and 2.4 hours for each day I rode.  I averaged 200.85 miles each week, riding 59 hours and 30 minutes total this month and burning some 43,600 Calories.  I cycled twice the number of miles (416.7) I set as my monthly goal.  I have ridden 6,143 miles in the past 12 month, and 3,158 mile this year already.  This is a new personal record and completely shatters my previous record of 611 miles set last month.
   Pictured are the stagnant waters of Starkweather Creek on the edge of Olbrich Gardens.  The waters are high as a result of a fairly wet spring.  With the soils saturated the waters are currently still and an algal bloom has resulted.  This mosquitoes have been particularly bad as a result.  Still, the waters look interesting.

June 28, 2018

Heavy Wright Iron Horse

   Today I completed my 800th mile for the month of June.  A couple days ago I ordered a hanging scale because I wanted to know what my bike weighted.  Fully loaded with water and summer work clothing my bike comes in at 70.6 lbs/32.0 kg.  That is fairly substantial—the Iron Horse isn't lite.

June 27, 2018

C compilers and circular shifts

I was evaluating some pseudorando m number generator (PRNG) and started wondering about compiler optimization. Many modern processors have a circular shift instruction, but languages such as C have no direct support for this. As a result, optimization has been designed to recognize circular shifts.

First, a circular shift:

output = ( input << shift ) | ( input >> ( sizeof( input ) * 8 - shift ) )

As noted most C compiler recognize this line of code as a circular shift and are able to implement the circular shift instruction rather than using two shifts and an OR.

I analyzed one of the smallest, fastest, and highest entropy quality PRNGs I tested was Xoroshiro128+. It is able to produce 1 TB of random data in 3 minutes (on a 3 GHz Core i7). The algorithm is quite simple:

result = state0 + state1
state1 = state0 ^ state1
state0 = ( state0 <<< 55 ) ^ state1 ^ ( state1 << 14 )
state1 = ( state1 <<< 36 )

All values are 64-bit.  The triple less than sign here means a circular shift left. The algorithm has a 128-bit state, meaning a period of 2128 (340 undecillion, or 340 trillion trillion trillion). On a native 64-bit machine the assembly is quite small.

64-bit x86 64-bit ARM
mov rax, QWORD PTR [rcx]
mov r9, QWORD PTR 8[rcx]
mov rdx, rax
mov r8, rax
add rax, r9
xor rdx, r9
ror r8, 9
mov r10, rdx
xor r8, rdx
ror rdx, 28
sal r10, 14
mov QWORD PTR 8[rcx], rdx
xor r8, r10
mov QWORD PTR [rcx], r8
mov x3, x0
ldp x2, x0, [x0]
eor x1, x2, x0
add x0, x2, x0
eor x2, x1, x2, ror 9
ror x4, x1, 28
eor x1, x2, x1, lsl 14
stp x1, x4, [x3]

Note that although the ARM assembly is less instructions, the x86 assembly can do several steps in parallel. I found this was an interesting exploration of both an algorithm and of modern C compilers.

   The price for continuous riding are days of less than ideal weather.  Rain was forecast for this afternoon.  Most of the rain lately has been in short dense downpours and I have been lucky to miss several of them.  As I started my ride home from work I could see heavy dark clouds in the sky and knew it could begin raining at any time.  In anticipation I put on my shoe covers and helmet cover.  I reached Waunona Way the rain started.  I pulled under a tree to put on my rain jacket and before long it was a heavy downpour.  My cycling shoe covers don't seal around the ankles and only delayed my feet from getting soaked.  This was one of the heaviest rainfalls I've ridden.  However, my bike handled well.  The new fenders perform nicely although I couldn't tell if the rear fender did a better job or not.  My old rear fender still produced a mud strip.  Due to the quantity of water from the rain I couldn't tell about the new one.
   The rain lasted until around I reached Monroe Street.  After that things reduced to a sprinkle.  I was quite soggy when I got home, but I've come to dislike the rain less.  The short ride home only added an additional 14 miles whereas the long route on the north side of the lake would be 20.  Still today rides give 754.7 miles for the month.
   Completed mile number 700 this morning and closed out the day with 725 miles total for the month.  The fatigue of a hard month of riding has set in, but I still have 5 days of the month left.  700 miles my goal.  So how about 800 miles?  That leaves 75 miles for the remaining days but even tired I should be able to do it.
   Decided this afternoon I needed cookie—from Waunakee via Martinsville.  I loaded up the newly repaired Iron Horse and set out on a 29 mile cookie run.  Almost lost a water bottle as I didn't tighten the screws on the rack enough.  After I noticed my mistake and was able to take the rack and bottle off and store it in a pannier.  Not the case for my media remote control.  I lost it somewhere along Martinsville Road or County P.  There was a thought about going to look for it, but of all the things I've lost from my bike I've never successfully found any of them.  In fact, I lost this remote once before and glued a string to it so it couldn't fall off.  But I attached the string to the hook-and-loop holder that attaches to my handle bars.  That entire assembly fell off on a bumpy downhill portion of the ride.
   The new front fork sits higher than my old fork, and makes for a more comfortable long ride.  I am able to set up more taking pressure off my hands and back.  It isn't perfect but a lot better.  Although I'm not a fan of riding in the rain I am curious how the new fender will perform.  Looking at the week ahead I may not have to wait too long for a trial.
   This ride puts me at 684 miles for the month.  I'm already at a personal record, and I have 6 more days of June.
   I got a call this afternoon telling me my bike was ready.  Excited to have the Iron Horse with a repaired front fork I suited up in cycling clothing and prepared to ride my loaner bike to the shop.  As I started moving the loaner out the door I noticed that lame resistance that is only caused by a flat tire.  There was nothing I could do.  All my tools are in my bike bag which is at the shop, and I didn't have an inter-tube for this skinny tire bike anyway.  With only an hour before the shop closed I had no choice but to put the bike rack on my car and drive.  You are not my friend loaner bike.
   At the shop the my bike looked good.  The front fork sits up much higher than the previous setup.  In addition it has fenders that were not installed by an idiot (i.e. me) and have braces to keep them true to center.  I would have liked to ride home and with our gathering in the evening I knew I just didn't have the time to get a ride in today.
   Ended the week with another ride to Waunakee at the end of my work day.  I've ridden all 5 work days every week this month and my monthly total now stands at 654.7 miles.  The loaner bike wasn't liking to shift into higher gears.  For lower gears the shift levers pull on cables.  For higher gears there are springs on the derailleurs that are supposed to push the against the pull of the cables.  Clearly the springs were not doing their job.  I thought maybe I spray of oil might fix this, but my oil is at the bike shop as it resides in my handlebar bag still on my bike.  So I took the bike to the shop on the way home.  It took the shop dude about 20 seconds to make an adjustment and sent me on my way.  Not exactly sure what he did but the gears were better behaved after that.
   The week has been rather rainy.  I got a few sprinkles today but wasn't drenched like yesterday.  The nice thing about the rainy weather has been the cloud cover.  Today there were a lot of wavy patterns in the clouds.  This is an HDR shop of the clouds just north of Middleton.
Collapsed Shocks

Collapsed Shocks

   Dropped the Iron Horse off at the shop this wet afternoon.  The rain was forecast to start latter than it actually did and I had rain on the ride into work as well as on the way home.  I was fairly wet by the time I made it to the bike shop.
   Pictured are the collapsed socks on my fork.  While I get a tune-up every year I wasn't told by any of the shops I use that they did not service shocks.  As a result something in them broke and they are as expensive to repair as they are to replace.  Since I don't ride off road I am having them replaced with a ridged fork which should give me a better traveling speed.  My bike shop has given me a loaner bicycle which is cool because I ride almost everyday.  Madison is such a cool city of cyclists.  I've never heard of a bike shop having loaner bikes.  But in Madison there are enough bicycle commuters like myself that the concept of loaner bike is a necessity.
   It is a strange feeling to ride a bike that isn't your own.  The bike I am riding is smaller than the Iron Horse, and sits more upright.  This is nice on my hand and back which give me problems after more than an hour of riding.  The bike doesn't have toe clips.  I brought a pair of normal shoes to change into at the shop as it is rather annoying to ride a bike in clip shoes when the bike doesn't have clips.  Right away I could feel a loss in riding power as there is no energy added in the upstroke.  Hills are slower because I cannot push and pull at the same time.  And my speeds are not as high. 
   The loaner bike also has skinny tires about half with of those on the Iron Horse.  They take between 50 and 75 PSI, and I put 60 in them just to make sure they had enough air.  The Iron Horse takes 50 PSI.  I noticed two things.  I feel the road a lot more which I expected.  What I should have expected but forgot about was the traction offered by smaller tires, or more accurately, the lack of traction.  Smaller tires mean less surface area making contact with the ground.  This is good for speed but not for grip.  I recalled this fact the hard way when I reached the Pheasant Branch trails.  There is a boardwalk through an area that can get (and is right now) fairly swampy.  The wood walkway can be slippery.  It has never been a problem on the Iron Horse, but not the case on the loaner bike.  I was moving about 12 MPH when the bike lost traction and I slide a long way on the wet wood surface.  While unharmed it was a rather harsh reminder that different bike configurations have different limitations.
   My ride today brings my monthly total to a record setting 612.3 miles for the month, and I still have 8 days of June left.
   I really like Indian food, and despite having just eaten at my favorite Indian restaurant on Monday I decided to bike the long way home and eat there again.  In Waunakee I stopped at a grocery store and picked up cookie.  I had a good eastern tailwind for the ride.  Winds are typically out of the west, but much of this month I have been getting strong winds from the east.