Obviously not all files would have the potential to infect as such and many would be dormant non executable files as such.
My guess there are priorities assigned, but also when you first do a scan, information can be gathered and if the file/s hasn't changed then the levels of checking could be reduced. So as you do more scans then this data would build up speeding scans. This used to be in the avast scan settings a long time ago, but is no longer available as a user settings option. I would guess that this is done by default.
I'm sure these methods would also be commercial in confidence.
Also - With a resident (on-access) scanner the need for on-demand scans is much depreciated. For the most part dormant/inert files are being scanned, the other active files are going to be scanned by the resident shields when they are activated. These would be scanned when created, modified, extracted or run. So dormant files don't present as great a risk as they would first need to be executed/extracted, etc. and at that point they would be scanned by the file system shield.
Generally I don't ever run on-demand scans other than when testing as a result of a question in the forums. I have been doing this for more years than I can remember, but it is your system and your choice.