in or out, they do that by sampling anyway.
Most shipments are cleared customs up to 1 day in advance.
If I remember correctly, about 7% of containers/lorries are pulled for inspection to check that the declaration is accurate. If there is a long queue, they simply pull fewer containers/lorries.