by userbinator · 6y ago · 0 comments
The touch command under OS X Lion (44,016 bytes).
...and I bet that one is dynamically linked.
I believe the reason why it's so fast is because it has no optimiser, and generates code as it parses. Pascal is also one of the easier languages to compile.
It supports 8 different flags (plus an undocumented -? flag), with support for using absolute or relative times, setting various timestamps on a file, and options for dealing with symlinks and permissions and such. More features than I'll ever need, but not outrageously so.
On Mojave, this file is only 23392 bytes, so it's no longer bigger than Turbo Pascal. Plus, automatic filesystem compression shrinks this down to only 7340 bytes on disk. Since blocks are 4096 bytes, this is actually the second-smallest (non-empty) file!
[1]: https://opensource.apple.com/source/file_cmds/file_cmds-287....
It's possible that the author is thinking of pre-TP4.0 chain files (which were used to get around the 64K memory limit of .COM format before TP switched to generating EXEs.)
$ bloaty `which touch` -d segments,sections --domain=file
FILE SIZE
---------------
55.1% 19.6Ki __LINKEDIT
91.7% 18.0Ki Code Signature
2.7% 544 Symbol Table
1.9% 376 Lazy Binding Info
1.6% 328 String Table
1.2% 232 Indirect Symbol Table
0.6% 112 Binding Info
0.2% 32 Export Info
0.1% 24 Function Start Addresses
0.0% 8 Rebase Info
0.0% 8 Table of Non-instructions
0.0% 0 [__LINKEDIT]
22.2% 7.90Ki __TEXT
35.0% 2.77Ki __TEXT,__text
33.6% 2.65Ki [__TEXT]
17.2% 1.36Ki [Mach-O Headers]
4.2% 339 __TEXT,__cstring
3.4% 274 __TEXT,__const
3.3% 266 __TEXT,__stub_helper
1.9% 150 __TEXT,__stubs
1.5% 120 __TEXT,__unwind_info
11.2% 4.00Ki __DATA
94.9% 3.80Ki [__DATA]
4.9% 200 __DATA,__la_symbol_ptr
0.2% 8 __DATA,__data
11.2% 4.00Ki __DATA_CONST
98.4% 3.94Ki [__DATA_CONST]
1.6% 64 __DATA_CONST,__got
0.3% 104 [Mach-O Headers]
100.0% 35.6Ki TOTAL
So 2.77Ki of actual code in "__TEXT,__text".Those [__TEXT], [__DATA], and [__DATA_CONST] sections are the part that is lost to padding, so 10.4Ki or so.
Disclosure: I am the author of Bloaty.