Log in

Recent Entries 
4th-Aug-2015 01:25 am - JIT Outrage and Lazy Dogma

For maybe obvious reasons, I've been thinking a great deal this week about the strong opinions people form on very little information. Even worse, people tend to fixate on a subset of the limited information they have available while actively ignoring the rest.

JIT Compilers

A number of modern computer languages have what are called Just In Time compilers, aka JIT compilers. With JIT compilers, a human writes source code in a human-readable form. There is usually then an initial compilation stage which does some simple validation and transforms it into a form suitable for interpretation by an idealized, imaginary computer. At some later point in time, the transformed version of the code is executed on an actual, real, live computer. The Just In Time compiler takes the transformed version for an idealized computer and turns it into actual code for this specific type of computer. With some super-fancy JIT compilers, the first cut at this is very basic with some modest assumptions as to how the code will be used. As the same pieces of code are run over and over again, a super-fancy JIT compiler might recompile the code with new assumptions (based upon past-usage) as to how the code will be used so that the code can be as streamlined as possible for the most-frequent or most-costly cases.

For systems without a JIT compiler, one of two approaches is taken. Some systems take the human-written source code and transform it for an idealized, imaginary computer and later emulate the imaginary computer using your actual, real, live computer. Other systems take the human-written source code and immediately transform it the whole way into code for your actual, real, live computer.

Those systems which emulate the imaginary computer sacrifice speed. Your computer cannot emulate the idealized computer nearly as fast as it could run its own stuff.

Systems which compile directly for the real, live computer sacrifice adaptability since they can only be run on computers which are almost identical (in hardware and operating system) to the one for which they were compiled.

Either way, without a JIT compiler, there is never an opportunity to revisit the initial assumptions about how the code would be used. Any optimization has to be done up front before the code is ever run.

As a real-world example, suppose that I have decided to write all of my email in Esperanto from now on. You might set up a filter on your mail-reader that invokes a translator when it goes to display any message from me so that you can read it in Klingon rather than Esperanto. This is Just In Time translation. The message sits in your Inbox in Esperanto. When you read it, it is transformed into Klingon. If, later, you decide that your preferred language is Elvish, you just have to re-open the message to get it in Elvish instead. The alternative, not-Just In Time version would be that I have the filter set up on my end so that when I write a message to you, it gets translated into Klingon before it gets sent. It sits in your Inbox in Klingon. Even after you've moved on to Elvish, that message will be in Klingon.

Lazy Evaluation

Most programming languages have an Eager evaluation model. With an Eager evaluation model, you can safely pretend that when you see multiple function calls in a row, the functions will be called in that exact order. For example, in the following code, the function foo() would definitely be called before the function bar().

   y := foo();
   x := bar();
   return pair(x,y);

With a Lazy evaluation model, when you see a call to a function, all you are really seeing is a promise to call that function if its value is every actually needed. As such, in the code snippet above, if there is something that foo() does with the global state of the program that bar() requires be done before it is invoked, you might end up out of luck. The model hasn't guaranteed the order these two functions will be called.

As a real-world example, imagine that you tell me to subtract the year Hannibal crossed the Alps from the year Madonna won her first Grammy Award and then write down my favorite color. I might search Google to find out when Hannibal crossed the Alps and when Madonna won her first Grammy Award. I might search for either one first. I might just write down my favorite color and not bother subtracting anything. I have done Lazy evaluation. If I were doing Eager evaluation, I would have had to look up when Hannibal crossed the Alps before I could even consider the question of when Madonna won her first Grammy Award and I would have to do the subtraction before I even considered what I should write down as my favority color.

I like to think of Just In Time compiling as lazy evaluation of the make me a version for my actual, real, live computer function. You don't actually need code that can be run on an actual, real, live computer until you are really, truly, about to run the code on an actual, real, live computer. If no one ever runs that code, there is never a need to compile it.


When do we form opinions? Are our opinions pre-compiled or compiled Just In Time? Are our opinions evaluated Eagerly or Lazily? At what point do we need an opinion?

Is the strength of our opinion correlated to the strength of the evidence we possess? Is our opinion taking into account how it is actually going to be used in this situation, or is it based on modest assumptions on how opinions are generally used?

Certainly, before flaming someone online, we have to have formed an opinion. Was it a Lazy opinion where we decided to comment and used all of the available information to form the opinion? Was it an Eager opinion where the opinion was already formed well before it was needed for this comment?

I, personally, have almost no drive whatsoever to flame someone online. As such, when the question is Should I respond (with vitriol) to this blog post or comment?, I never need to try to calculate an opinion. When I do try, I find that I'm stretching my opinion over shockingly wide gaps in the landscape to try to make very sparse evidence cover very large ground.

I have been realizing this past week though, that I do calculate opinions early and on little information on other questions like Should I go to this event? or Do I want to talk to this person? I close many doors with barely a glance as to what's behind them.

It is time to flush the caches. It is time to recompile the routines that were compiled with very little information on how they'd actually be used.

1st-Jan-2015 05:22 pm - Books I read in 2014

I managed to read even more this year than last. Here's what I read in 2014.



Fiction that I bailed out on before the end:

Non-fiction that I bailed out on before the end:

16th-Sep-2014 07:31 pm - Quote of the Day
Men have always had to pay for sex—in money, marriage, respect, long-term commitment, or willingness to help raise children.Erotic Capital: The Power of Attraction in the Boardroom and the Bedroom by Catherine Hakim

It's not clear to me whether men have to give up some of the respect that would otherwise be theirs, have to respect women, or both to get sex. I feel like I should understand this before I go any further.

Also, it's manifestly clear that women do not incur these costs. Um.

4th-Sep-2014 10:43 am - Lies are not statistics...

I am reading Erotic Capital by Catherine Hakim. One of the author's contentions is that despite large amounts of propaganda to the contrary, men generally do want sex more often than women do. To this end, she cites some surveys that asked the question: Do you wish there were more sex in your current relationship? The numbers seem pretty clear after age 20 that men more often feel there should be more sex in their current relationship than there is. The only way that I feel the numbers might be misleading (assuming no reporting errors) is that if women are far more likely to draw the distinction between more sex and more sex in this relationship.

So, fine. But, then the argument jumps the shark when it goes on to talk about the number of sexual partners men have in their lifetimes versus how many women have in their lifetimes. I almost crashed my car last night thinking about how wrong this argument was. I was trying to find the right analogy and totally believed while doing this that the cross-traffic at my intersection had a stop sign. I got some angry honks, but that's way better than getting hit. And, it's way better than the math in this book.

From the context, it seems clear that, for the purposes of the surveys involved, sexual partner means sexual partner of the opposite sex. The book says that survey after survey shows that, on average, men have two to three times the number of sexual partners in their lifetime than women have. It cites this as evidence that men want sex more often or just more than women do.

Let's do the math. How do we calculate the average number of sexual partners men have? We ask every man, How many sexual partners (of the opposite sex) have you had?. We sum up all of those and divide by the number of men surveyed. How do we calculate the average number of sexual partners women have? We ask every woman, How many sexual partners (of the opposite sex) have you had?. We sum up all of those and divide by the number of women surveyed.

Assume for a minute that we were able to survey a whole, closed population. For every woman on a given man's list of female sexual partners, that man is on her list. This is true for every man. For every man on a given woman's list of male sexual partners, that woman is on his list. This is true for every woman.

Some part of your brain is probably trying to figure out a way where if things were imbalanced enough... if there were a few really active women and lots of moderately active men or some such thing, it might still work out. It doesn't. It's like saying that on average Canadians enter two to three times as many buildings as they exit each day.

Where does this leave us? This means that for it to be true that men have two to three times the number of sexual partners in their lifetimes than women have, either:

  • Men live two to three times as long as women,
  • There are two to three times more women than men, or
  • Some combination of the two

None of that is borne out by the demographics. Women live longer than men and make up a (slightly) greater proportion of the population.

What do the surveys show then?

It may be there are a few women with anomolously high numbers of sexual partners who also manage to slip through the cracks of the survey. This seems highly unlikely. Even if true, it doesn't bolster the argument that men want sex more than women do.

It may be there are a few men with anomolously high numbers of sexual partners who manage to get picked for all of the surveys. This seems highly unlikely. Even if true, it doesn't bolster the argument that men want sex more than women do.

It may be that men and women differ in how well they remember the number of sexual partners they have and that one group is or both groups are systemically wrong in exactly the right way to make this impossible statistic. This seems highly unlikely. Even if true, it doesn't bolster the argument that men want sex more than women do.

It may be that women, in general, have a narrower definition of what constitutes a sexual partner than men do. This doesn't seem unlikely, but it also doesn't bolster the argument that men want sex more than women do.

It may be that there are societal pressures for men to inflate their numbers (even on anonymous surveys) and/or for women to deflate their numbers (even on anonymous surveys). I think it's undeniable that this is the case and could easily account for the whole of the two to three times factor. It still doesn't bolster the argument that men want sex more than women do.

If I were arguing that Canadians prefer being indoors to outdoors and cited a statistic saying Canadians enter two to three times as many buildings on average as they exit each day, I should be pilloried.

I'm not saying men do or do not want sex more than women do (or that Canadians prefer being indoors or out). I'm saying that citing these surveys as evidence of an argument either way destroys your credibility.

I don't know if I can keep reading this book.

29th-May-2014 10:00 pm - My #YesAllMen Pledge

I have been reading through #yesALLwomen threads and #notALLmen crap. I've been trying to think of what best I can contribute to move the ball forward. Here's my first step.

#YesAllMen Pledge

I recognize that misogyny is pervasive in our society. I recognize that circumstances and privilege make it hard for me to see all of the ways misogyny affects the lives around me (even my own life). It is with this in mind that I pledge:

  • I will believe you when you tell me you were victimized/diminished by misogyny;
  • I will strive to see misogyny so you will not even have to tell me;
  • I will call people on their misogynist behaviors/attitudes when I see it;
  • When you call me on my misogynist behaviors/attitudes, my first words will be acknowledgement and apology;
  • When you point out misogyny that I have missed, I will thank you and strive to see that form of misogyny and others like it from that moment forward; and
  • I will never attempt to justify misogynist behaviors/attitudes: even partly, even my own, and even when there are worse examples in the world.

Further, as a parent, I will strive to raise my children to do the same.

Every time misogyny is beaten back, wonderful fruits blossom in its place. How great it would be if the oppressed/repressed could freely contribute their gifts and talents into making this a better world.

Misogyny diminishes us all.

2nd-Jan-2014 05:49 pm - Books I Read in 2013...

I've read a great deal more since I've bought a NOOK GlowLight than I ever have before. Here's what I read in 2013.



Fiction that I bailed out on before the end:

Non-fiction that I bailed out on before the end:

For most of those books, I have reviews on Goodreads, but feel free to ask me more about any of them.

17th-Dec-2013 01:24 pm - One thing about my wife....
There are many, many things to love about my wife eyelid. One that I'm not sure I've ever mentioned to her before is this....

eyelid has an amazing aptitude for grokking stories and the characters in them. When I read a book, I tend to float along letting the characters do what they do and letting the story go where it goes. Even with just a few seconds of catching her up on the plot of what I'm reading or watching, she immediately calls out how/why some character action lacks any motivation or is out of line with the rest of the character. She's incredibly insightful and fast. It amazes me each time.

Just one of the ways she keeps amazing me day after day.
At 10AM the day before, mix 150g of King Arthur Bread (or All-Purpose) Flour and 150g of water with the tiniest, tiniest sprinkle of Rapid Rise (Bread Machine) Yeast. I use a steel bowl and then invert a slightly larger steel bowl over it to keep it from drying out much.

At bedtime the day before, add 350g of flour and 350g of water. Mix well. Keep covered as before.

At 10AM the day of, add 500g of flour, 120g of water, 35g of salt. Mix well. Wait 20min. Knead for 8min. Divide into halves or thirds. Wait 10min. Shape into final shape.

For round loaves, put a towel in a bowl that's just barely big enough for the ball of dough so the loaves have to rise up instead of out. Put the loaf inside the towel with the bottom of the loaf up. Cover the whole loaf with the ends of the towel.

For long loaves, use a towel as a couche ( http://www.wildyeastblog.com/wp-content/uploads/2007/07/batards-in-couche.jpg ) with folds of the towel separating the loaves. Put one edge of it against the wall and use cookbooks or rolled up towels to keep pressure on the opposite edge so the loaves have to rise up instead of out.

Let dough rise for 3hr and 15min (your time may vary depending on the room temperature. Our house stays at 74-degrees).

Pre-heat oven with pizza stone to 550-degrees making sure it is at temperature at least 45min before bread is ready. I also keep a cast-iron skillet on the lowest rack of the oven. For round loaves, I also put a dutch oven (I have one cast-iron and one enamaled, both work quite well but the enameled one is a bit cramped) with lid in the oven for each loaf.

For round loaves, I put them in the dutch ovens, score the tops of the loaves with a razor blade or somewhat-serrated knife, put the lid on, put back in the oven. Lower temp to 485. Bake covered for 30min and uncovered for 10min (or until well-colored).

For long loaves, (or if you don't have dutch ovens): Put parchment on a cookie sheet with no edge (or on upside down sheet). Carefully move the risen loaves to the parchment by hand. Score the tops of the loaves with a razor blade or somewhat-serrated knife. Slide parchment onto the pizza stone. Put 1/2 cup of crushed ice cubes into the iron skillet on the lowest rack. After 5min lower temp to 485 and bake for 17min (or until well-colored).

If the bread is coloring too quickly, cover with foil to slow down the color while getting heat to center.

Remove bread from oven and put on wire racks to cool. There should be audible crackling of the crust here, especially dramatic if you didn't use a dutch oven.

Note: I have tried at least a dozen brands of bread flour and all-purpose flour. King Arthur flour costs at least twice as much but would be a bargain at eight times as much. It's the best by far.

Minimal yeast at the start ensures that the chemicals they use to process and preserve yeast don't dominate. The high water/flour ratio at the start allows the yeast to move around. Salt inhibits yeast development so it comes as late as possible. French bread ratios are 100 flour :: 62 water :: 2-4 salt (by weight). Pizza stone ensures bottom of bread gets blasted with heat when bread goes in. Dutch ovens ensure moisture from bread helps gelatinize the crust rather than waft out of the room. Crushed ice in pan tries to do the same but oven is so porous that it doesn't make all that much difference (still looking for an alternative, may have to get or make some baguette cloches http://www.breadtopia.com/store/media/OblongBrotformandCloche.JPG but all the ones that I've seen are too wide and too short).

If the times don't work well with your schedule, 4-5hrs in the fridge is about the same as 1hr on the counter.
17th-May-2013 10:04 pm - Applicable Proofs...

We both know it's been forever since I posted on LJ. This one's too long for Twitter and doesn't mesh well with my mostly-Lisp blog. 'Nuff said.

I've started reading The Golden Ticket: P, NP, and the Search for the Impossible by Lance Fortnow. So far, I'm enjoying the material. However, he keeps smacking into one of my biggest math peeves: Proof is Panacea.

Before I explain that or mention how it relates to Fortnow's book, let me tell you where Numbers smacked into this peeve.

Season One, Episode Five guest-starred Neil Patrick Harris. NPH was close to a proof of the Riemann Hypothesis. The Riemann Hypothesis is closely linked to the distribution of prime numbers. Prime numbers are intimately involved in much of the encryption technology in use today (even more so back when that episode first aired).

In the episode, NPH's daughter had been kidnapped by some baddies that were demanding a complete proof of the Riemann Hypothesis as ransom. Part of the premise of the episode was that with such a proof the kidnappers would be able to decrypt any secure internet transactions. Modern civilization would fall apart.

At the time, eyelid asked me, What would happen if someone could prove the Riemann Hypothesis? My thought at the time (and still), is absolutely nothing in any sort of short timeframe beyond winning the author a Millenium Prize.

If there is anything you can do to break today's encryption schemes once you know the Riemann Hypothesis to be true, then you can already do that just by guessing that the Riemann Hypothesis is true. Sure, there is a small chance that there will be some new tool or new revelation that comes out of the manner in which the Riemann Hypothesis is proven (or falsified) that might eventually make finding particular primes easier. I consider that a small chance and only after years of delving.

It is a sad truth that many of the great proofs are non-constructive. One of the easiest ones to follow is Euclid's proof of the Infinitude of the Primes. Suppose for a moment that there aren't infinitely many primes. If that were the case, there would only be N of them for some (possibly large) number N. If you multiply all of those primes together you get a number that is divisible by every prime number. If you add one to that number, now you have a number that has remainder one when divided by any prime number. So, either this number is prime and wasn't on your list, or you missed some prime that divides into this number. It must, therefore, be impossible to have a finite list of all of the prime numbers.

What can you do now that this has been proven that you couldn't do before this was proven? You can prove things that depend on it being true, but what can you do. The answer is nothing new. You can't even name a single prime number that you should have had on your list. You can't tell whether any given number that didn't make your list is prime or not. You can't tell how many primes you might have missed. Anything you can do because we've proven there are infinitely many primes, you could have done with just the supposition (or hope) that there were infinitely many primes.

I can understand how a TV drama might ignore that inconvenient truth so it won't fizzle the tension in your plot, but I can't forgive Fortnow the same sin. Fortnow says over and over again that if you can prove that P = NP then you can do all kinds of things easily that everyone else still considers hard. You'll be able to optimally route your Travelling Salesman, you'll be able to crack my public key, you'll be able to optimally fit your stuff into the minimum number of moving truck trips, and you'll be able to play a perfect game of Tetris if you know what order the pieces will come out.

First, as does Fortnow, I consider it very unlikely that P does equal NP. Second, even if P = NP, I'd only give it about a one in fifty chance of being provable. Third, if it's provable, I'd give it a one in one thousand chance that the first proof will be constructive. Fourth, even if it is constructive, I'd only give that a one in ten chance of showing any way to find an algorithm in P to solve any given problem.

Fortnow knows way more about P vs. NP than I do. Maybe he knows something that he's not letting on about that guarantees that the only way to prove P = NP is by demonstration. If that's the case, I sure wish he'd tell me. But, I think he's either just caught up in how cool it would be if NP were P or he's just building drama by sweeping truth under the rug.


Suppose that you're travelling with four kids in the car. It's getting to be time for lunch and you want to exercise the kids a bit. Ohio has very nice rest areas, but you think a mall would be a better fit. So, you search Apple Maps for a mall.

You've just passed the I-90/I-75 interchange. You don't want to go back for all of the malls on the west side of Toledo, so you settle on the Woodville Mall.

You get there to discover that the Woodville Mall is all but condemned.

Fortunately, the babies have dozed off again. You need gas, but the gas stations near the mall are $.15/gallon more than the ones just off the highway were. So, you figure there will be some gas stations near the Sandusky Mall. You head out.

You get to point B and haven't seen a gas station. You search Apple Maps. It says that Coles Energy, Inc. is at around point D and Shumaker Gary BP is at point C. You decide that Coles Energy is probably a gas company rather than a gas station. You head back to Shumaker's. You find that Shumaker's is a BP distribution station. There are six tanker trucks and zero pumps.

You stop at a nearby restaurant. You explain to the lady behind the counter that you're just passing through looking to get to the Sandusky Mall and are in dire need of gasoline. She says, Hmmm... and freezes up. You're thinking, Fabulous. The nearest gas is going to be 30 miles back toward Toledo.

Finally, someone else jumps in and points you back toward point D. There are three gas stations right near there which did not show up on Apple Maps. Coles Energy was right across from the one you stopped at. Coles, indeed, could provide for you if you had needed propane, but not petrol. You got gas. Now, off to the mall.

Now, you are flipping back and forth between Apple Maps and Google Maps to compare. Google Maps had Shumaker's on it. It also had one of the three gas stations that had been right on your path. Of course, somewhere in here, Apple Maps quit giving you spoken directions. So, you missed the turn at point B in the previous map. You kick Apple Maps back into action and it leads you through the path shown to point C.

Point C is not anywhere near the actual Sandusky Mall. It is out in the sticks. You passed through a closed campground and past a few farms and through some sparse neighborhoods to get to point C. There is no mall there at all. There are dirt roads. There is a bay.

Of course, you're way far away from decent cell reception now. Neither Apple Maps or Google Maps can properly locate you. You track down an intersection that's big enough to register on Google Maps and start heading to what you hope is the real mall with Google Maps now.

Now, there is a gorgeous rainbow over the road and an Ohio trooper that just pulled over to start clocking cars. You were also expecting the exit to be labelled Milan Road. You miss the turn at point B and turn around at point C.

You make it almost to point D and fear that what was labelled Sandusky Mall on Google Maps and the exit you took off of Ohio-2 is really just a Meijers store. Thankfully, you just gave up a few hundred feet too early. The mall does exist, is open, does sell food, and does have a children's play area. Now, it's dinner time.

Having been awake for 34hrs now, you send your spouse in with the kids while you take a somewhat cramped nap on the floor of the van. The nap is surprisingly pleasant until your boss calls to remind you that you need to turn in your timecard sometime in the next 18hrs.


This page was loaded Dec 1st 2015, 12:51 pm GMT.