What does Hypo-Allergenic Mean?

Since my son suffers from mild itchiness of the skin when using ordinary body washes, I was researching alternate body washes and found a few products labeled “hypo-allergenic”. I have come across this label before and have not paid much attention to it. But imagine my surprise when I found that Wikipedia defined the term to be a “marketing” term with no medical basis! Wow! And to think that I bought a couple of brands of body washes based on this term thinking it might be suitable for my son. I’ll still try these brands and see if they cause less irritation to my son’s skin. I am also planning to try Tom’s Body Soap — seems like this does not have Sodium Lauryl/Laureth Sulfate and has all natural vegetable based ingredients.

Share

Detroit Electric

On a visit to the San Jose History Park (part of Kelley ParkHappy Hollow Zoo area in San Jose, CA), we found a refurbished/refitted electric car exhibited in the “Trolley Barn“. This car was supposedly originally manufactured and sold in the early 1900’s.

I was amazed that as early as 1907, electric cars were one of the alternative types of cars being manufactured and sold. It seems like we’ve come a full circle with electric cars gaining importance now.

The particular model in the exhibit was called the “Detroit Electric” and sold in 1917 according to the blurb near the exhibit. See pictures below.

The History Park is an amazing place to visit for history buffs and for children.

Share

C if-else Optimization

When doing some maintenance work on C code (refactoring!), I wondered if I should code C if-else clauses in some particular way to take advantage of modern processor pipelines and caching.

It seems obvious that if you have multiple else-if clauses, then putting the most likely to execute code in the first if clause would be the best (since it avoids subsequent checks most of the time), but what about the case that you only have a two-way if (cond) {…} else {…}  type of code, should you place the code most likely to be executed in the if clause or in the else clause? It would seem that it shouldn’t matter either way since there is only one condition being checked. But…

I did some experimentation on a system at hand (an Intel Pentium system with a small program compiled using gcc) and found that putting the most likely to be executed code as part of the else clause consistently had better timings. Be warned that this was just a simplistic “add-two-values-stored-in-variables-in-one-line” kind of code — definitely not a good test, but sufficient for me to satisfy my curiousity for the time being.

Google searching seemed to indicate that the performance depended on the ‘branch prediction‘ capability of the processor. I also found out that gcc has a compiler directive (__builtin_expect()) that one can use to provide a hint to the compiler so it knows what is the most likely outcome of a if conditional check and generate code suitable for the branch prediction capability of the target processor. The gcc manual recommends against using this directive though! See more details regarding this directive here.

Share