To explain the comparative behaviour roughly: shelling out has a fixed overhead; the ls command will have been optimised for the platform. opendir/readdir on the other hand has variable overheads, is probably not optimised for a fixed platform, so will begin cheaper but grow with the filecount to eventually overtake the fixed overhead of shelling out.
One world, one people
In reply to Re: opendir slower than ls on large dirs?
by anonymized user 468275
in thread opendir slower than ls on large dirs?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |