node
node copied to clipboard
macos: remove CoreFoundation dependency?
Commit b1741ea1fadf from 2014 claims -framework CoreFoundation
is necessary to make the Heap Allocations recorder in Instruments work properly.
In my limited testing I didn't spot a difference with or without CoreFoundation. I'm not invested enough in macOS to dig deeper but maybe someone wants to verify and open a pull request. Removing it should save some startup time.
Forgot to mention, CoreFoundation is together with libSystem and libc++ one of only three start-up dependencies and at 20 MB it's by far the most massive of the bunch. Transitively it pulls in 53 MB of shared libraries.
For comparison: libSystem's and libc++'s transitive footprints together are < 12 MB.
$ for LIB in `otool -L $(which node)|grep current|awk '{print $1}'`; do wc -c `otool -L $LIB|grep current|awk '{print $1}'`; echo; done
20808624 /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
28112240 /usr/lib/libobjc.A.dylib
57376 /usr/lib/libDiagnosticMessagesClient.dylib
6805664 /usr/lib/libicucore.A.dylib
186480 /usr/lib/libz.1.dylib
61408 /usr/lib/libSystem.B.dylib
56031792 total
61408 /usr/lib/libSystem.B.dylib
83936 /usr/lib/system/libcache.dylib
193424 /usr/lib/system/libcommonCrypto.dylib
161280 /usr/lib/system/libcompiler_rt.dylib
136960 /usr/lib/system/libcopyfile.dylib
1185792 /usr/lib/system/libcorecrypto.dylib
828656 /usr/lib/system/libdispatch.dylib
605024 /usr/lib/system/libdyld.dylib
44512 /usr/lib/system/libkeymgr.dylib
58704 /usr/lib/system/liblaunch.dylib
99264 /usr/lib/system/libmacho.dylib
73520 /usr/lib/system/libquarantine.dylib
57808 /usr/lib/system/libremovefile.dylib
297920 /usr/lib/system/libsystem_asl.dylib
44176 /usr/lib/system/libsystem_blocks.dylib
1437088 /usr/lib/system/libsystem_c.dylib
84336 /usr/lib/system/libsystem_configuration.dylib
77168 /usr/lib/system/libsystem_coreservices.dylib
136208 /usr/lib/system/libsystem_darwin.dylib
102016 /usr/lib/system/libsystem_dnssd.dylib
804064 /usr/lib/system/libsystem_info.dylib
755200 /usr/lib/system/libsystem_m.dylib
408784 /usr/lib/system/libsystem_malloc.dylib
182304 /usr/lib/system/libsystem_networkextension.dylib
110528 /usr/lib/system/libsystem_notify.dylib
85104 /usr/lib/system/libsystem_sandbox.dylib
67152 /usr/lib/system/libsystem_secinit.dylib
546768 /usr/lib/system/libsystem_kernel.dylib
141568 /usr/lib/system/libsystem_platform.dylib
171856 /usr/lib/system/libsystem_pthread.dylib
117136 /usr/lib/system/libsystem_symptoms.dylib
295696 /usr/lib/system/libsystem_trace.dylib
112544 /usr/lib/system/libunwind.dylib
656224 /usr/lib/system/libxpc.dylib
10224128 total
1432816 /usr/lib/libc++.1.dylib
339520 /usr/lib/libc++abi.dylib
61408 /usr/lib/libSystem.B.dylib
1833744 total
There definitely is a difference from what I am seeing with and without CoreFoundation on macOS 12.6 (Kernel 21.6.0)
Screenshot with CoreFoundation:
Screenshot without CoreFoundation:
With CoreFoundation, I am able to actually see a stack trace
I did run some benchmarks and could not find a noticeable difference in startup performance though. I wonder if that is due to the dyld shared cache. It does also look like most dependencies of CoreFoundation are weakly linked. idk if it is helpful and doesn't have a performance impact, I'd say we should likely keep it around, since it's quite useful when using Instruments
Thanks for investigating. I'll go ahead and close this then.