Two of my applications "SyncTwoFolders" and "ManageNameExt" (on my page ) do recursice call inside folder.
On big folder (my X-Plane folder contains 176 958 items) I don't have StackOverflow error but it is very long, and I have strange result. I have not the same result in a sub-folder when I treat the big parent folder than when I treat the subfolder only.
I made a short application which is approximatively the same except that in my app I do something with the items :
First column is the index of the items, 2th column is the time it took to dd this item in the ListBox.
3th column is Ratio, the time it took divide by the index of the item (then the count of items).
Ratio = 600 x (TicksSinceThreadStarts / LastIndexItems)
With a folder < 40000 items I don't see problem. On bigger folder (X-plane), Ratio begin at 5 (firsts items) and is 70 for item #7000 and Ratio = 127 for Item #13000 and ratio = 200 at item #22020 .
I have a MacBook Pro (Retina, 15 pouces, fin 2013) - 2,3 GHz Intel Core i7 - 16 Go 1600 MHz DDR3 under Mojave.