If you can get curves rather than closed Breps, there’s a tool in Grasshopper called Region Union. I’ve uploaded an example with some internalised Breps.
The script takes your Breps, finds the face with the lowest z-coordinate center (so the bottom face), explodes it into its curves, joins the curves, then takes all the curves and uses Region Union on them to produce the effective combined outline of your Breps.
(Edit - note that there may be a more efficient way to always select the bottom face; this is just how I’ve been doing it for a while - main point though, curves → Region Union)
I didn’t have that issue, but I also only tested on the boxes I posted there.
I did a quick test and arrayed out the sample boxes. With 3000 closed polysurfaces (so 600x the 5pc example I posted) the script took 2.8s. With 9000, it took 14.7s.
I then took the Mesh Shadow example posted by @HS_Kim above (only up to the Mesh Shadow component, not the surface projection) - the 9000 closed polysurface example completed in 6.7s, so I’d say that’s an even more elegant solution. In fact, 18000 polysurfaces only took 24.2s on my machine. If that gives you the results you need, I’d say go with that!