This step is implemented by ArchiveBuilder::gather_source_objs(), which iterates the metadata with ArchiveBuilder::iterate_sorted_roots(). All objects that are eligible for copying are entered (by reference) into ArchiveBuilder::_rw_src_objs or ArchiveBuilder::_rwro_src_objs, depending on whether they are read-write or read-only.
Here are the elapsed time of the following test cases (which archive more than 20000 classes) using fastdebug build:
|Old||42.655 sec||67.014 sec|
|New||37.027 sec||34.974 sec|