Have thought about timing of whipping, and looked a little bit at the maths of 1 population = x shields. I need to do a bit more though, it doesn't seem to be a completely linear case of 1 pop is always x shields, so 2 pop is 2x, etc.
Seems that in order to get cash, you need the shield overflow to be bigger than the shields for whatever you are building, which is doable either on small builds like warriors, or via chopping. i.e. you have a library at 120/135 (all numbers pulled from butt, as per normal) shields. So to whip it up to 135, it takes 1 pop, that gives you 80 shields, so there's 65 overflow. Before the whip though, you chop a forest for 90 more shields. They don't appear until the next turn, so you can still whip, and now the overflow is 155 shields, bigger than the 135 of the library. So you'll get some cash, instead of all the overflow going to shields. At least, that is my first impression of the mechanic. Need to do some more research.
As for when to whip, in the absence of other considerations, it seems there will always be the most benefit from whipping on the last turn before completing the build. Say you're size 7, 10 turns from finishing something. You whip, then you spend 10 turns at size 6 working on the next something. Or you wait 9 turns at size 7, then you whip, and spend 1 turn at size 6 working on the next something. You get the same shields from the whip either way, but you've got 9 more turns of an extra citizen to work a tile.
Of course, other considerations make a big difference. i.e. whip earlier means 9 more turns of benefit from the thing you whipped. It means unhappiness drops again 9 turns earlier. It means you can whip something else straight away. Plus there's no point staying at size 7 if you have an unhappy citizen, or lots of unimproved tiles to work, because then the production of that 7th citizen doesn't actually make up for the cost of feeding them. So you want to whip earlier.