Duplicating 10000 cubes with Alt+D: **13.52s -> 2.23s (6x faster)** (Windows, VS2022 Release build, AMD Ryzen 5950X).
Previous code was doing 2N collection syncs when duplicating N objects. New code avoids all the intermediate syncs by using `BKE_layer_collection_resync_forbid` and `BKE_layer_collection_resync_allow`, and then does one `BKE_main_collection_sync` and one `BKE_main_collection_sync_remap` for the whole operation. There is some complexity involved where the `Base` things of newly duplicated objects can't be found yet, without the sync, so some work on them (marking them selected, active, ...) has to be deferred until after the sync.
@TODO: add links to possibly relevant tasks: T 73411, D 11889