Allocating a single stat is O(n) where n is the maximum number of stats that the shared memory can hold. So allocating all of the stats takes O(n^2).
For the default value of 16k stats, this took approximately 1 second, which isn't unreasonable to pay when starting up and/or loading a large config.
When the maximum number of stats is 100k, my benchmark took approximately 2 minutes.