So putting status aside for a second, I have some thoughts on speed. Basically the problem is we're doing size(tree) lookups. I propose that we walk the tree gathering file versions we want to export (for exporting a working tree this suggests using CURRENT to me). iter_changes is probably the right interface to use. Then we can emit all the directories to the exporter at once; after that we can walk the files to export via tree.iter_files_bytes().
So putting status aside for a second, I have some thoughts on speed. Basically the problem is we're doing size(tree) lookups. I propose that we walk the tree gathering file versions we want to export (for exporting a working tree this suggests using CURRENT to me). iter_changes is probably the right interface to use. Then we can emit all the directories to the exporter at once; after that we can walk the files to export via tree.iter_ files_bytes( ).