## Tuesday, September 21, 2010

### Adventures in Little Things Making a Big Difference

So, at work I work with some scientists in a field that rhymes with shmooclear shmisics.  These people are very smart application scientists, but definitely not computer scientists.  I love them because as long as they exist, I will always have a job.  They write pretty miserable code, because that's really not their thing.  They just want to do the science.

Half of my job with them is improving their code, but more importantly (if I want my efforts to not be wasted), I spend a lot of time developing a working relationship with them.  You see, they are a kind of insular community, and don't generally trust some "hot shot" outsider who doesn't know the science.  But I have been able to do a few simple things that have drastically improved the performance of their codes, so I think we are getting somewhere.

Most recently, I was profiling one of their codes, and discovered that it spent more than 50% of its time sorting.  I looked at their sorting algorithm and saw that it was some homebrew sorting algorithm that was kind of like bubble sort (with computational complexity order N2, or the worst possible performance without doing something completely stupid).  My guess is, they didn't know that some smart computer scientists had thought a lot about sorting algorithms and developed smart ways to sort; they probably just thought of how they would sort things and implemented that.  So I replaced their Frankenstein sort with a heapsort algorithm (worst-case complexity N log N) and the sorting became an insignificant portion of the total runtime.  Then, I showed my primary collaborator what I had done, and they discussed it in a meeting the next week.  As it turned out, nobody knew why it was sorting; it was some legacy of an abandoned algorithm.  I removed the sorting altogether and am in the process of doing a little benchmarking study.

It was pretty amazing, though, that this piece of code that nobody realized was being executed was taking up more than 50% of the test problem runtime, and more than 20% of the benchmark problem runtime!

The next bottleneck in their code is the I/O.  They are reading the input in a very unintelligent way (all the processors opening the same file and reading it), so I plan to fix that for them when I get the chance.

## Monday, September 20, 2010

### Vacation in My Future

I am pleased to report that there is a vacation in my near future.  I have a student coming to work with me beginning next month, but there are times when he will be gone to some conferences, so I will be able to take some time off then.

This is really good because I have kind of a short fuse these days from not being able to be away from work.  I still have quite a bit of work to do this month, but after that, I am looking forward to a vacation!!!

## Sunday, September 19, 2010

### Judge Not, and Don't Feel Judged

I grew up in a very judgmental family environment.  We were a liberal/progressive family, so the judgment didn't manifest in disapproval of others' life choices; it manifested in the conclusion that everyone should think just like us.

After my parents' divorce, I was forced to rethink everything -- to reexamine the structures in my mind.  It was hard -- but it was also freeing.  I railed against this idea nine years ago, but as some of the people in my adult children of divorce mailing list said (the ones who were further past the traumatic events), the divorce was truly one of the best things that ever happened to me.

I left no stone unturned.  I felt, for the first time, free to do what I concluded was right, rather than what others told me was right.  I grew up.

Many things I reconsidered and came to the same conclusion, e.g., washing your hands after you use the potty is a good idea.  Other things I reconsidered and came to a deeper conclusion, e.g., respecting other people's autonomy extends to their freedom to think and draw (possibly erroneous) conclusions, in addition to their life choices.

And still other things I reconsidered and came to a different conclusion.  One of those things is about judging others and taking offense.  I used to look at everyone and make judgments about their intrinsic worth.  I was taught to take the tiniest thing, and analyze it to a conclusion about that person's character.  For example, a woman touching her hair while she's talking to you is vain.  After that, it was hard for them to change in my eyes, except perhaps for the worse.  In return, I always felt judged by other people, and took the conclusions to which I believed they had arrived quite personally.

Then I learned that there are entirely different ways of thinking about other people.  You don't have to categorize and judge people; furthermore, people don't fit well into the boxes we put them in.  For example, I had a professor who had once done something to offend me who I had to work for shortly after my parents announced their intentions to divorce.  I was very angry and apprehensive about working for him, because I thought he was really unkind and judgmental.  As it turned out, we ended up getting along very well, and he was highly supportive of me both personally and professionally.  He was a little eccentric and socially unskilled, yes, but had the best of intentions.

I also learned that I don't always have to think the worst of others when they do "bad" things.  I've talked about this before in terms of people doing mean things to me, but this also extends to people who make life choices I would not make or draw erroneous conclusions due to what I perceive as poor judgment.  So, instead of automatically assuming that a poor person who eats a lot of fast food is lazy or gluttonous, I can examine all the factors that have led to those in poverty eating such unbalanced diets,* and actually come to a more positive conclusion.

Today, I tend to suspend judgment of other people.  This is not to say that I just let somebody who did something hurtful to me do it again; I just don't take their bad behavior and subtract from their intrinsic worth as a human being.  As much as I dislike some people, they are human beings and deserve at a minimum a basic level of respect and dignity.

This also means that I deserve a basic level of respect and dignity, something I didn't realize before.  By being less judgmental of others, I am also able to feel less judged myself.  And that is a huge weight off my shoulders.

* Fast food is cheaper (per calorie or per ounce) than nutritious food, so a person with little money would choose fast food to maximize the fullness of their belly, under constraint of their small budget.  Furthermore, there is a paucity of fresh and nutritious food in poor, urban neighborhoods (which are often referred to as "food deserts"), making it even more difficult to get nutritious foods.  Given all the constraints on time and budgetary limits, I would probably make the same choice in the same situation.

## Saturday, September 18, 2010

### Happy Birthday to Me!

Today is my birthday!  I am 35, which is the product of two odd prime numbers (5 and 7).  I haven't been the product of two odd primes since a decade ago (25), and won't be again for 14 more years (49) 4 more years (39).* which is the product of twin prime numbers (5 and 7).  I was last the product of twin primes two decades ago (3 and 5), and I will never again be the product of twin primes unless I live to be 143 (11 and 13).

The next time my age will be the product of two prime numbers that are adjacent in the sequence of primes is when I am 77.

Just as something cool to think about, 5 and 7 are one less than and one more than 6, respectively.  Remember in algebra the product of x-1 and x+1?  It's x2-1.  Plugging in six for x, we have an alternate way of computing 5 times 7. Six squared is 36, and 36-1=35.  Cool, huh?

This formula is actually more handy for computing the squares of numbers without resorting to a calculator or long hand calculations, in my experience.  For example, what is 21 squared?  It's 20 times 22 plus 1: 440+1 = 441.  You can change the 1 to any integer a, and get a formula (x-a)(x+a) = x2-a2.  So what is 43 squared?  It's 40 times 46 plus 9: 1840+9 = 1849.

* Math is hard.  Also, I need a vacation.

## Tuesday, September 14, 2010

### Projection

Me: Vinny, I have a question for you.  Daddy's birthday is on Friday.  What do you think we should give him?
Vinny: Hmm.  Maybe a remote-controlled car.*
Me: ...

* Apparently Jeff got the same answer when he asked Vinny what they should give me.

## Thursday, September 02, 2010

### Spinner for Dinner

The money we spent on a fun food game for Vinny is arguably the best money we've ever spent.  Vinny is a picky eater and doesn't like to try new foods.  We bought this game that consists of a plate that's kind of like a cafeteria tray from elementary school, except that in each part of the tray it has a picture.  Then there is a spinner with those pictures, and which ever one you land on when you spin, you have to take a bite of the food in that part of the tray.

Vinny absolutely loved playing "spinner for dinner" as he put it.  He even tried a food that we thought he would like but would not have tried without "spinner for dinner."  And he liked it!