Speedup using dir iterator