I encountered this with libafl-frida ASAN's shadow map on my mac. On my machine, this code takes about 20 seconds to run.
For some reason it seems that the kernel splits the big allocation to many small ones of size 0x8000000, and the majority of the time is spent on the __proc_info calls here https://github.com/frida/frida-gum/blob/main/gum/backend-darwin/gumprocess-darwin.c#L1901.
I encountered this with libafl-frida ASAN's shadow map on my mac. On my machine, this code takes about 20 seconds to run. For some reason it seems that the kernel splits the big allocation to many small ones of size 0x8000000, and the majority of the time is spent on the __proc_info calls here https://github.com/frida/frida-gum/blob/main/gum/backend-darwin/gumprocess-darwin.c#L1901.