I'm really surprised this performs better than the RecursiveIteratorIterator implementation :/.