Aaron Turon b536d2bb76 fix O(n^2) perf bug for std::io::fs::walk_dir
The `walk_dir` iterator was simulating a queue using a vector (in particular, using `shift`),
leading to O(n^2) performance. Since the order was not well-specified (see issue #13411),
the simplest fix is to use the vector as a stack (and thus yield a depth-first traversal).
This patch does exactly that.  It leaves the order as originally specified -- "some top-down
order" -- and adds a test to ensure a top-down traversal.

Note that the underlying `readdir` function does not specify any particular order, nor
does the system call it uses.

Closes #13411.
2014-04-24 10:34:13 -07:00
..
2014-04-18 17:25:34 -07:00
2014-04-23 13:15:32 -07:00
2014-04-18 17:25:34 -07:00
2014-04-18 17:25:34 -07:00
2014-04-18 17:25:34 -07:00
2014-04-18 17:25:34 -07:00
2014-04-18 17:25:34 -07:00
2014-04-18 17:25:34 -07:00
2014-04-18 17:25:34 -07:00
2014-04-21 00:49:39 -04:00
2014-04-21 00:49:39 -04:00
2014-04-21 00:49:39 -04:00
2014-04-21 00:49:39 -04:00
2014-04-23 23:35:45 +08:00
2014-04-21 00:49:39 -04:00
2014-04-18 17:25:34 -07:00
2014-04-18 17:25:34 -07:00
2014-04-21 00:49:39 -04:00