Why is get_batches so slow?

What is it doing “under the hood” and why is it taking so long? I thought it wasn’t reading the images into memory so therefore it shouldn’t take so long.