It's interesting that the difference in productivity is only 12%. I'd think a happy developer would be significantly more productive than a miserable one, far beyond 12%, just from personal experience of coding when I'm down and when I'm not.
You are over-interpreting the study. The difference in productivity was for the task of adding five two digit numbers. This is a simple task very different from software development. The paper presents no evidence that effects on performance on this task is indicative of performance on other tasks.
Also, this experiment investigated short term happiness shocks, not long term general happiness levels. When the happiness shock was in the form of food, performance increased 15%.
Having done piece-rate work during college summers, I think that a 12% piece-rate difference would be much larger in software contexts. To me, software productivity is about maximizing the amount of work not done.
That is, productivity comes by things like preventing bugs, keeping the code base clean, finding minimal implementations, avoiding gold-plating, and seeing our way around apparently hard problems. I think that sort of calm cleverness, like most creative work, is worlds easier when I'm happy.
In making good things, I also draw a lot upon my empathy for users. When happy, my reserves of empathy are much deeper.
Doesn't this imply that if a company is spending more than 12% of its workforce-related costs on perks and other happiness-inducing stuff, then it could save money by cutting all that and hiring 12% more workers?
Not necessarily. For it to be true you would need to make the following assumptions:
1) Perks-related expenditure have a linear effect on happiness
2) Productivity is a linear function of the number of workers
3) The caliber of the 12% additional workers you'd hire after cutting costs is comparable to those of the workers you had before
4) Happiness only affects productivity, but not retention (turnover costs companies a lot of money in lost productivity)
5) There are no positive externalities caused by the presence of happy employees
1), 3) and 4) are debatable -- in many cases, the ability to make employees happy (and thus attract/retain strong performers) depends on the company culture, and having perks is an important part of it. This also means there are probably a lot of relatively cheap and cost-effective perks an employer can provide that can make employees much happier (fun company offsites, flexible hours, etc.).
2) is somewhat true for some industries, but tends to be false for knowledge workers like in the tech industry, where what you want is better quality output as opposed to simply more output. Also relevant is Brook's law ("adding manpower to a late software project makes it later"). Teams do not scale up linearly because it requires additional training, management overhead, and makes communication and coordination a bit more complex.
All these are fairly straightforward, but I think 5) would be interesting to investigate: from my experience happiness and enthusiasm tends to be contagious, and it's probably a good thing for a company to try to get a core of really motivated employees that can inspire others.
I didn't read the study but this making the mythical man-month assumption. Also, let's say this is the case, unhappy tend to want to be happy and I don't think you will have creative people, such as programmers, very long if they are unhappy.