I'm not sure how accurately the Bitmain driver handles the work difficulty from the pool.
I do it as follow:
https://github.com/ckolivas/cgminer/blob/master/driver-bitmain.c#L592Thus the nonce finding variance of the Ant is close to the share finding variance - which reduces internal IO from the Ant chip also.
The Ants can do work difficulty at a power of 2 - 1, 2, 4, 8, 16, 32, 64 ,128, 256, 512, 1024, 2048, 4096 (I stop at 4096 so direct solo gives results)
So if the pool difficulty is e.g. 300 the ant will mine internally at 256 difficulty and since the hash rate is based on nonces found, the hash rate's variance will be the equivalent of mining on a pool at 256 difficulty so will be noticeable.
Bitmain's driver does this also, but I'm not sure how accurately - it may be the same or lower for them.
I do not understand the code, but I think I follow the rest of what you are saying.
One question remains to me, is my machine actually hashing faster, as reported, for the 1-2 days after a restart, or is the elevated rate merely a result of the difficulty/nonce reason above? If it is actually hashing faster then I should be restarting it every day or two, the difference is like a free usb stick or 3.
Thanks again.
If it's consistent, then it is hashing faster.
Where it starts, depends on the luck in the early time after the start ... up to an hour or so ... then it will gradually average out to the expected rate.
If you are lucky at the start it can be quite high, I've had my S3 mine at around 500GHs for an hour - luck/variance - but eventually it settles down and heads towards 440.
Think of it like block finding.
A pool can get lucky and find lots of blocks fast and get unlucky and have long dry spells of no blocks.
Over time the expected average of a pool is 100% diff (less orphan rate)
WIth the S3, it's on a much smaller scale, but the same idea.
Over a days or two it will certainly approach the average expected hash rate, but when you first start it up the variance can seem quite high.
This is, again, due to the fact that it is returning a LOT fewer nonces.
If it is internally mining at 256 diff, then it will have only 1/256th of the amount of results - so it's sort of like saying it will take 256 times longer to average out - well it's not 256, but the idea is the same. That's variance.
It's not affecting the number of shares you are submitting to the pool.