It looks like the slowest paths of the transcendental functions were improved by a lot. But how often do these paths get used? The article doesn't say so the performance benefits may be insignificant.
They don't get used very often. I don't know how much though because that would require running the functions for the entire domain of inputs which would be years for the univariate functions and pretty much forever for pow. If you want anecdotal data then I have that: I didn't hit the slow path of log for the entire week I threw different inputs at it. pow hit quite a few in an hour of running but even that was about 1 in 1000 or less. However, since there is no pattern to determine which interval of inputs will have more slow path hitting inputs, you can never say that only 0.1% of the inputs use the slow paths. Consequently, I cannot really give an average case picture based on these improvements.
That said (as I've mentioned elsewhere), my main motive of writing the blog post was to share the methods, which I believe are more interesting than the results themselves. The results are not satisfactory IMO since there is still a lot more work to be done.
Curiously, the Red hat dev did not comment on average case performance improvement, only on the slow path improvement. I initially missed that in a quick reading, as, I suspect, did many others.
It is difficult to compute impact of this work on the average case because we don't know precisely how many of the inputs in the entire domain (i.e. all unique FP representations in an IEEE754 double) are serviced by the slow path. I wasn't able to get the libm code to go down the mp path for the log function after a week of throwing different inputs at it. pow on the other hand hit it fairly regularly in an hour. Even the 'fairly regular' is about 1 in a 1000 inputs, so that is not much. We know that it is low enough that not a lot of people have complained about it, just some (and not all) math intensive applications. Perhaps a study similar to the worst cases paper I cited (the link is wrong btw, I'm working on getting that fixed) will give a better idea.
The other reason is that the slow path is literally thousands of times slower, so the impact it will have on the average case will depend greatly on the kinds of inputs an application uses. So in that context, talking about an average case with an arbitrary percentage of slow inputs (say 1%) would be cheating because it may show incorrectly large improvements.
Finally, the point of my post was more about sharing the methods I used for improvements than the statistics. I am personally not satisfied with the statistics because there is a lot more that can be done.
PS: I am the Red Hat dev who wrote the post (if it wasn't obvious) and the correct link to the paper is: http://perso.ens-lyon.fr/jean-...
I fail to see the impressive part. Impressive would have been fixing GCC to optimize simple functions on its own.
memcmp (and the other functions like it) is something that gets repeated in slight variations in code A LOT, and is trivial to implement. This is almost a textbook optimizer target if I've ever seen one.
The optimizations talked about here are specific to processor models (e.g. AVX and SSE for intel) and not just architectures. Compiling them into programs is a bad idea^^, so improving gcc is not an option. The glibc mem* functions have implementations for each of those processor features and the right function to use gets implemented via the STT_GNU_IFUNC mechanism based on the features the current processor has.
^^ If you don't know why it's a bad idea, it's because you don't want to compile your program for every machine you want to run it on. You want to compile for the general architecture so that it can be distributed widely.
The Hurd project isn't mentioned anywhere in the mailing list post.
It's my understanding that the Hurd project uses a customized version of glibc.
That should be read as: "If you're compiling on Linux, we're assuming that you have 2.6.16 or later". This is because we assume presence of some features in some of the Linux-specific code. Hurd is not mentioned anywhere because there weren't any noteworthy changes to hurd-specific requirements.
The power outages last an hour everyday during summer, not more than that. If it's more or even erratic, you need to register a complaint and it should get fixed. These outages can be bought out from MSEB in exchange for higher electricity bills that are more in line with other power suppliers (Reliance, Tata). For example, MSEB supplies power to the navi mumbai region of maharashtra and there too they used to have similar power cuts for the same reasons. Through a petition, they got rid of the power cuts in the Kharghar node of Navi Mumbai at the cost of paying higher bill rates.
Mumbai city (or any area that is not provided for by the MSEB) does not have load shedding, mainly due to the fact that it is a major financial hub of the country.
What I implied by regular is that electricity is definitely not intermittent; I agree that what I said was not accurate to the word, but my intention was to refute the 'intermittent' word. You have regular power in Pune most of the time, with load shedding during summers for an hour or less every day or for 6 hours in one day of the week depending on the region (I have lived in at least 2 regions of Pune for some time to know this). This too is planned and practically every resident knows the timings for the cut in their area.
I clarified in a later post that I am not claiming that things are perfect, but simply throwing money at them is not the solution. The electricity issue involves hundreds of factors, the primary one being acquiring land of farmers, re-routing rivers and potentially destroying some aspect of the ecosystem of the said river. Wind and solar power projects are way too expensive to even be an option right now. Despite that, India is 5th worldwide in wind power generation.
It is extremely annoying when practically every major achievement or goal set by India is welcome with cynical nonsense like the OP without any real knowledge of the ground situation.
I never denied in my post that there is a lot of scope for improvement of infrastructure and a lot of need for it too.
At the same time things are not as simple as what the OP suggested or you concluded through your observations over 2 years. There are certain standards that are very important to us and you will recognize them too, but there are other standards that we don't really care about. For example, a lot of people in the west are paranoid about cleanliness of water and food hygiene. While we in India are very particular about hygiene, we do not go so far as to avoid street food or drink out of a tap or even from a nearby stream/pond. Oh, and we eat with our hands! Ok, it is not as simple as I state here either, but I cannot think of a way to put all of it in a single post. You really need to tour the entire country to understand how things are, observe our politics, read our history. You will realize that things are not necessarily better or worse; they're just very very different and highly complicated.
Also, reforms are not as simple as throwing money in because the social structure and culture of India is much more complex than that. The sheer size of the population brings about major challenges that merely throwing money does not solve. We have done really well in just 60+ years of independence; probably better than any country given the size of our population and political issues with our neighbours.
Just out of the top of my head, here are some things the neutrino lab will help with:
All of this revenue loops back into the budget for further reforms and the process itself enriches so many people. I'd say this is much better than the money we're spending in building all those temples or mosques or churches.
I do not see how this type of project is sanctioned by the Indian government.
With money that is bookmarked for such projects. Believe it or not, third world countries have finance ministers who plan and reserve portions of funds for different causes and do not simply dole out cash to whoever asks for it.
Half the population is living in slums
Nonsense, unless you call the huts that a lot of tribes live in or cabins built in the mountains as slums too. People are fairly self-sufficient and are generally healthier than the average city yuppie. A very small number of people are actually in such a dire situation that they're dying from starvation.
Most parts of the country have only intermittant electricty
Rural areas do have this problem, but every place from small towns and cities have regular power supply. It is definitely not a problem in "most" of the country.
There is almost no safe water (by Western European standards)
There are almost no people with weak immune systems (by Western European standards)
The majority of the population is functionally illiterate.
Now where did you get that from? And what do you mean by that?
The roads are amongst the most dangerous in the world
They're definitely not as safe as the ones in the more developed countries.
Pollution (air, water, and waste) is a HUGE problem
in the entire world, not just in India.
Umm, ok. My comment was not meant to be an informative piece; I was actually expecting my comment to be modded flamebait or funny if anything. I was attempting to show that for the sake of argument anyone can make up stuff and have it sound very interesting and knowledgeable but it probably did not come off very well.
Given the amount of money flowing in and out of India that is a result of VPN's, skype and google I seriously doubt this will happen.
RIM is one thing. Skype and Google quite another. You might as well pass a law requiring that everybody in India stop using Windows. Not gunna happen.
VPN, true. Skype and Google? Seriously? How does Indian get any revenue from Skype and Google? If you're suggesting that they are the only email/VOIP providers in India then you're totally wrong. Most serious email users will use either their ISP accounts or buy a professional service along with hosting. Others don't really care if it is hotmail, yahoo, gmail, rediffmail, sifymail, indiatimes mail, etc. VOIP has not caught on enough for anyone to be affected badly enough by the lack of skype.
Now Windows is a valid point. But hell, how many people in India do you think use a legal copy of Windows? And what's so bad about banning Windows anyway
For every bloke who makes his mark, there's half a dozen waiting to rub it out. -- Andy Capp