The initial startup of a compiled application with many compiled modules takes a while on macOS. I believe this is because the built-in malware scanner checks all the .so files as they are accessed, and there's one .so per compiled module plus a shared one typically. The shared one contains almost all the code, while the others are just tiny wrappers that call into the shared lib. The wrappers are currently loaded on the first import of a module, I think.
If a compiled module imports another compiled module, we could maybe perform the import directly without leaving the shared library, i.e. we wouldn't need to use the wrapper library. So if there's a single entry point to a compiled program and every module is compiled, maybe it would enough to access two .so files (entry point wrapper lib + common shared lib). This could apply to mypy and mypyc, for example. The other wrapper .so files would normally not be accessed.
I'm not sure how to implement this exactly, but it seems worth a try. The time to run mypy for the first time after installation on macOS might get a lost faster, which would be nice.
The initial startup of a compiled application with many compiled modules takes a while on macOS. I believe this is because the built-in malware scanner checks all the .so files as they are accessed, and there's one .so per compiled module plus a shared one typically. The shared one contains almost all the code, while the others are just tiny wrappers that call into the shared lib. The wrappers are currently loaded on the first import of a module, I think.
If a compiled module imports another compiled module, we could maybe perform the import directly without leaving the shared library, i.e. we wouldn't need to use the wrapper library. So if there's a single entry point to a compiled program and every module is compiled, maybe it would enough to access two .so files (entry point wrapper lib + common shared lib). This could apply to mypy and mypyc, for example. The other wrapper .so files would normally not be accessed.
I'm not sure how to implement this exactly, but it seems worth a try. The time to run mypy for the first time after installation on macOS might get a lost faster, which would be nice.