4 ms·
And for small files, like most mail messages tend to be unless they have a lot of attachments, creating a hard link is no faster than actually copying the file.
by Locke1689 17y ago
And for small files, like most mail messages tend to be unless they have a lot of attachments, creating a hard link is no faster than actually copying the file.
[citation needed]
- jmtulloss 17y agoIn my unscientific trial, it looks like the hard link is an order of magnitude faster. Still, it takes time. $ du -sh README.markdown 4.0K README.markdown $ time ln README.markdown README.markdown.link real 0m0.002s user 0m0.000s sys 0m0.001s $ time cp README.markdown README.markdown.copy real 0m0.041s user 0m0.000s sys 0m0.002s
- lisper 17y agoThat's pretty unscientific :-) To measure anything that fast reliably you have to do it more than once: [ron@mickey:~/foo]$ cat foo foo [ron@mickey:~/foo]$ time for i in {1..1000}; do cp foo foo.c.$i; done real 0m2.705s user 0m0.524s sys 0m2.190s [ron@mickey:~/foo]$ time for i in {1..1000}; do ln foo foo.l.$i; done real 0m2.618s user 0m0.486s sys 0m2.008s
- jrockway 17y agoNow you are measuring the speed of the fork/exec call. To really do this right you need to write a small script that copies the file 1000 times or creates a hard link 1000 times.
- lisper 17y agoNo, fork is a lot faster than disk I/O: [ron@mickey:~]$ time for i in {1..1000}; do echo foo>/dev/null; done real 0m0.064s user 0m0.039s sys 0m0.025s
- deleted 17y ago[deleted]