http://www.perlmonks.org?node_id=112892


in reply to Re: Is readdir ever deterministic?
in thread Is readdir ever deterministic?

I concur, especially since testing for . and .. is not especially expensive. Sure, there are 2 extra checks per directory entry, but unless a profiler tells you that is a specific performance problem for your program, IMO it's not worth the potential maintenance problems to "optimize" it. Later programmers might not immediately understand why the code did that, and it could the time of those assigned to maintain that code.