diff options
author | Rui Ueyama <ruiu@google.com> | 2016-12-05 17:40:37 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2016-12-05 17:40:37 +0000 |
commit | 6d12eaee8b57e72c6da156f1c5667f3125771ce1 (patch) | |
tree | 62304047eb42ee23b989f6ab2e448555a2fa53b4 /llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | |
parent | 28f05acec183a73bca0389208a4cf1db7a798b10 (diff) | |
download | bcm5719-llvm-6d12eaee8b57e72c6da156f1c5667f3125771ce1.tar.gz bcm5719-llvm-6d12eaee8b57e72c6da156f1c5667f3125771ce1.zip |
Remove existing file in a separate thread asynchronously.
On Linux (and probably on other Unix-like systems), unlink(2) is
noticeably slow. It takes 250 milliseconds to remove a 1 GB file
on ext4 filesystem on my machine, whether the file is on SSD or
on a spinning disk.
To create a new result file, we remove existing file first. So, if
you repeatedly link a 1 GB program in a regular compile-link-debug
cycle, every cycle wastes 250 milliseconds only to remove a file.
Since LLD can link a 1 GB in about 5 seconds, that waste actually
matters.
This patch defines `unlinkAsync` function. The function spawns a
background thread to call unlink. The calling thread returns
almost immediately.
Differential Revision: https://reviews.llvm.org/D27295
llvm-svn: 288680
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
0 files changed, 0 insertions, 0 deletions