Saturday, November 9, 2013

Swale Burial

I guess the labor participation rate is down to 33% or something like that. I thought I had a line on something, but I guess I'm still part of the majority. I don't like the idea of being on too many lists, whenever I need to deal with the government it makes me nervous. Signed up for healthcare because my old state run system was closed for Obama. It worked second try, then they sent me a new DSHS identification card unsolicited, after signing me up for the renamed free state plan, but sending me no health card.  I'm guessing that they'll transfer records over from the old system eventually. Honestly, I get by, I just need my diabetes meds, and a checkup once in a while. Everyone who was paying attention knows they made a bunch of places dig nice drainage swales in the last decades, I'd hate to think they were just getting ready to have the mass graves all dug ahead of time for their death panels. I don't hate the president, Kristallnacht should never happen again. No one should censor the internet, the TEA party shouldn't be harassed by the IRS, businesses shouldn't be extorted and taken over by the government, and most of all people shouldn't have to start dying. Millions of people are being dumped from their health care plans, many of those plans were keeping chronically ill people alive. The insurance companies called these people "bad apples", they were losing money on them, but they were required to pay out, now they can drop the plans because of the president. The new state plan is "apple", that's not a good sign.

Friday, February 15, 2013

Driving Costs

The average American driver drives something like 15,000 miles in a year. That represents at least 250 hours of driving (based on an average speed of 60 miles per hour). The average car has a range of around 300 miles, so that 15,000 miles represents 50 trips to the pump, which at 5 minutes per fill up would be a little longer than 4 hours. So overall the average commuter is spending the equivalent of about 31 eight hour days driving every year... a full months worth.

The average plug-in hybrid driver probably only needs gas 10 times a year or so, or 50 minutes at gas stations in a year. However, they need to plug the car in, which might take a minute or so, and unplug it before they leave, which could take another minute, so over the course of a year there's 12 hours of plugging in and out. There's some experimental "park over" chargers that  might help eliminate that, if you take the time to install that... in both your garage floor and in your car. And there is the time for having the plug-in charger installed, though that will no doubt be done by someone else.

So time wise it's about 254 hours for a gas car, and 263 hours for a plug-in electric hybrid car. So it costs 9 hours more, or 3.5% more time to plug-in. The average hourly wage is something like $19.50, though it fluctuates, so overall driving time represents a loss of productivity of around $5,000 per person. $175 more if you drive a plug-in hybrid.

The workforce participation rate is something like 65%, so this $5000 per person represents about $1.17 Trillion in lost productivity. If all workers switch to plug-in hybrids (this isn't likely), the productivity lost will increase to $1.2 Trillion. There's that 3.5% again... so $35 Billion more lost since GDP is something like $15 Trillion that would be only a 0.25% decrease in the GDP. All based on a few minutes plugging in every day.

Friday, January 18, 2013

Large Files (some understandings)

Haskell tries to memoize everything at top level. That is, it tries to store the results in memory. So if you have some function that is supposed to be processing for a single line in a file ProcessLine :: Handle -> IO() then what happens is that if that code prints something that depends on the input, that is it depends on some content in the file you are opening, then it will evaluate the action. Otherwise it just stores the action to execute later. With a large file that might mean that every call to a ProcessLine function is just storing more into memory. More worryingly, it breaks specified action order sometimes, calling file actions after the file is closed. So essentially Haskell's handling of imperative programming order is somewhat broken, which makes sense, that part of the language is the part that the gurus don't like, so they write their code as pure functions, that part of the code remains untested in places, or they just think it's what should be.

The solution then is just to go ahead and fit all IO into one monolithic call that fits into memory, and write things in pure code like ProcessFile::IO() and ProcessLine :: String -> String and then just map a whole file lazily. In general, since ProcessFile is returned as a single action at the top level, using hGetContents will end up not being all stored in memory unprocessed. There's still some limits here, because ProcessLine might get memoized, and there's no method that I've found yet to just say not to do that.