This patch removes the call to 'count' during an agent's processing, which is just an 'is-empty' test, which can also be achieved by a null test on the peek.
Overall, 'count' seems to generate a lot of garbage, the holistic reduction of which would be out-of-scope for a simple patch on a maintenance branch.
GC tuning for agents
Don't call count, which can be expensive. Just peek and if its not null, treat that
as being > 0