Towards inflation-indexing wages

Posted on December 3rd, 2008 by Tim.
Categories: Tim.

During periods of general deflation, a firm tends to lay off employees rather than adjust wages downwards. The firm was previously at an equilbrium employment level, so why does it make sense to cut the number of workers rather than adjust wages to match the level of deflation? The problem is that when wages are cut, the good workers are more likely to leave than the bad workers, since the good workers are more likely to believe they can get jobs elsewhere. Laying off employees gives the firm the choice of which people to keep.

Ideally, the firm would really want to keep the same level of employees (assuming all other things are constant). Before the inflation occurred, the firm was presumably at an employment level equilibrium maximizing profit (marginal product of labor was 0). If wages could somehow be “inflation-indexed” during times of deflation without the psychological effect of a wage cut, the firm might have a more efficient outcome.

I think one way that you see firms trying to do this is through bonus systems. It’s common for executives to have bonuses contingent on the nominal company performance (which will correlate with deflation), which in a way is sort of inflation-indexing. According to a friend of mine working at Royal Dutch Shell (aka Shell Oil), bonuses are based on both performance reviews and company performance. At Microsoft, bonuses are primarily based on performance, but I would not be surprised if adjustments to the bonus schedules are based on economic conditions.

It’d be nice if we could make wages less sticky while avoiding the psychological effects of a wage cut…

0 comments.

Reversing bits

Posted on November 11th, 2008 by Tim.
Categories: Programming, Tim.

Reversing the bytes of an integer is a reasonably common operation when doing network programming, especially when dealing with possibly differing endianness. Reversing the endianness came up at work today, so I was thinking about a slightly different problem.

Given a 64-bit integer, what is the fastest way to reverse the ordering of the bits? The naive approach is to use a loop getting 1 bit into place each iteration. The result is something like this:

private static ulong RevBits1(ulong p)
{
ulong r = 0;
for (int i = 0; i < 64; i++)
{
r = r >> 1;
r = r | (p & 0x8000000000000000);
p = p << 1;
}
return r;
}

If you don’t count the loop operations, this ends up with 256 operations, 4 per iteration. If you unroll this, you can make one of the terms a constant factor, bringing the operation count down to 192. We can improve on this with a divide and conquer approach:

private static ulong RevBits(ulong p)
{
p = (p << 32) | (p >> 32);
p = ((p << 16) & 0xFFFF0000FFFF0000) | ((p >> 16) & 0x0000FFFF0000FFFF);
p = ((p << 8 ) & 0xFF00FF00FF00FF00) | ((p >> 8 ) & 0x00FF00FF00FF00FF);
p = ((p << 4) & 0xF0F0F0F0F0F0F0F0) | ((p >> 4) & 0x0F0F0F0F0F0F0F0F);
p = ((p << 2) & 0xCCCCCCCCCCCCCCCC) | ((p >> 2) & 0x3333333333333333);
p = ((p << 1) & 0xAAAAAAAAAAAAAAAA) | ((p >> 1) & 0x5555555555555555);
return p;
}

Harder to read, but this version is only 28 operations. In asm we could get this down even farther on 64 bit machines, since the first statement can be written as a 32 bit rotation, and the second statement can be written as two 16 bit rotations, bringing our operation count down to 24. Since each of our other operations is nearly equivalent to an opcode (on 64-bit processors at least) this is pretty close to the actual number of opcodes that could be generated by a good optimizing compiler.

It would be interesting to see if this could be optimized further :-)

-Tim

0 comments.

Corporate Comics

Posted on March 28th, 2008 by Tim.
Categories: Business/The Software Industry, Tim.

Next time you’re in an interview for a technical position, try to find out the favored comic at that company. If the favorite comic is Dilbert, be on the lookout for PHBs. If the favorite comic is XKCD, you probably want to accept an offer. If the favorite comic is Garfield, I don’t know what it means, but you probably want to run like hell.

1 comment.

Where Do Choices Come From?

Posted on March 20th, 2008 by Chris.
Categories: Chris, General/Misc., Tim, UI Design.

[14:38] Me: http://headrush.typepad.com/photos/uncategorized/2007/04/06/featuritis.jpg
[14:38] Gas: lmao
[14:38] Gas: funny thing about the downslope
[14:39] Gas: the problem is that[sic] the features aren’t discoverable
[14:39] Gas: in my mind though, that’s a solvable problem
[14:39] Gas: the real problem
[14:39] Gas: is that the more features you have, the more spread your engineering effort is
[14:39] Gas: testing, bugfixes, etc.
[14:39] Me: hmm
[14:39] Me: i think they’re both part of the problem
[14:39] Gas: the first problem is an essentially UI problem
[14:40] Gas: in theory, i think all UI problems can be solved
[14:40] Me: why?
[14:40] Gas: if a person can explain what they want to do, and assuming that feature exists, then a person should be able to explain to a computer what they want to do
[14:40] Gas: this is of course at a very theoretical level
[14:41] Me: a person can’t always explain what they want to do
[14:41] Gas: that’s a requirement
[14:41] Me: ?
[14:41] Gas: if they can’t explain what they want, they aren’t going to get it no matter what
[14:41] Gas: so it doesn’t matter whether the feature exists or not
[14:42] Gas: unless we know what they’re going to want and tell them what they want
[14:42] Me: it’s like a menu
[14:42] Gas: feature != menu item though
[14:42] Me: i may want duck a la’range
[14:42] Me: but not know what i want
[14:42] Me: infinite features are possible in a restaurant
[14:42] Gas: duck a la’range?
[14:42] Me: idk
[14:42] Me: it was in a sbemail
[14:42] Me: i forget which
[14:42] Gas: lol
[14:42] Me: anyways
[14:43] Me: i could tell the chefs what i want and how it should be made
[14:43] Me: but, for whatever reason, that doesn’t work except for chefs (programmers)
[14:43] Me: alternatively, i could have a menu with every conceivable item
[14:43] Me: but that’s ridiculous – the menu would be 1 billion pages
[14:43] Me: so the menu has a limited selection of items
[14:44] Me: and makes it easier for me to find something i want
[14:44] Gas: that’s an interesting analogy
[14:44] Me: it may not be perfect
[14:44] Gas: but
[14:44] Me: but it’s something i like
[14:44] Gas: here’s another analogy
[14:44] Gas: that manages to bind the two
[14:44] Me: ooooooooooh
[14:44] Gas: so you know that gas station
[14:44] Gas: that serves the food
[14:44] Gas: what’s it called?
[14:45] Me: sheetz
[14:45] Gas: thanks
[14:45] Gas: yeah
[14:45] Gas: sheetz goes one step closer to being a chef
[14:45] Gas: rather than a menu
[14:45] Me: sheetz….umm, sheetz has a menu
[14:45] Gas: and there’s no reason it has to be a physical menu being displayed
[14:45] Me: i’ve been there
[14:45] Me: the menu is just a touch screen
[14:45] Me: and instead of asking you if you want pepper
[14:45] Gas: yes, and everything is customizable
[14:45] Me: there’s a pepper checkbox
[14:46] Me: that’s all
[14:46] Gas: ok
[14:46] Gas: now extend that one step further
[14:46] Gas: no explicit menu
[14:46] Gas: but a voice recognition system
[14:46] Gas: “i want a burger with cheese”
[14:46] Gas: adding new features clutters no old features
[14:46] Gas: it’s a UI problem
[14:46] Me: well
[14:46] Me: your UI model works
[14:47] Me: let me try and explain where it differs
[14:47] Me: lets say i’m at a restaurant with no menu
[14:47] Me: i tell the waiter i want a burger
[14:47] Me: i can order whatever i want
[14:47] Me: and there’s no limitation
[14:47] Me: right?
[14:47] Me: but, there IS a limitation
[14:48] Me: where did i come up with this idea of “burger”?
[14:48] Me: from my own head, of course
[14:48] Me: so, we’ve basically moved the set of available actions
[14:48] Me: from a screen, where i don’t have to remember it
[14:48] Me: to my head, where i do
[14:49] Me: the UI will always be simple, since it only does what i want it to do
[14:49] Me: but i’m limited by what i know how to want
[14:49] Me: http://www.bluej.org/mrt/?p=31

0 comments.