2 ms·
While simple scripts can produce binaries as small as simple C programs, you are forgetting that dynamically loading libraries has its own cost. e.g. a "hello w
by koito17 3y ago
While simple scripts can produce binaries as small as simple C programs, you are forgetting that dynamically loading libraries has its own cost. e.g. a "hello world" on my machine is a 50 kb binary, which sounds awesome, but running otool on the binary shows a different story.
hello:
@rpath/libecl.21.2.dylib (compatibility version 21.2.1, current version 0.0.0)
/opt/local/lib/libgmp.10.dylib (compatibility version 15.0.0, current version 15.1.0)
/opt/local/lib/libgc.1.dylib (compatibility version 7.0.0, current version 7.2.0)
/opt/local/lib/libffi.8.dylib (compatibility version 10.0.0, current version 10.2.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.100.1)
Depending on how many dynamically linked libraries you have to load, this can result in lower runtime performance than simply using e.g. Clozure CL, which has pretty fast startup time (approx. 13 ms on my machine) but much larger binaries since the binary is essentially self-contained and contains a whole CL implementation, runtime, kernel, etc. inside.
- shrubble 3y agoYes I have found that in my testing of other compiled programs, where you have a choice between dynamically loaded libs and compiling fully static. It would be a trade-off and even on simple programs there is a difference in RAM usage and execution time due to the overhead.