]> git.lizzy.rs Git - rust.git/commitdiff
auto merge of #13720 : aturon/rust/walk_dir-perf, r=alexcrichton
authorbors <bors@rust-lang.org>
Thu, 24 Apr 2014 20:51:19 +0000 (13:51 -0700)
committerbors <bors@rust-lang.org>
Thu, 24 Apr 2014 20:51:19 +0000 (13:51 -0700)
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, and adds a test checking for depth-first behavior.

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

Closes #13411.


Trivial merge