Skip to content

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Oct 14, 2024

We were calling llvm::sys::fs::rename with the assumption that it fails immediately if savedPathBuf does not exist. But on Windows, the rename is retried 200 times with 10ms delay = for 2s, causing the creation of a new indexstore-db take 2s longer than necessary on Windows.

// Retry this a few times to defeat badly behaved file system scanners.
for (unsigned Retry = 0; Retry != 200; ++Retry) {
if (Retry != 0)
::Sleep(10);

We were calling `llvm::sys::fs::rename` with the assumption that it fails immediately if `savedPathBuf` does not exist. But on Windows, the rename is retried 200 times with 10ms delay = for 2s, causing the creation of a new indexstore-db take 2s longer than necessary on Windows.

https://github.com/swiftlang/indexstore-db/blob/6120b53b1e8774ef4e2ad83438d4d94961331e72/lib/LLVMSupport/Support/Windows/Path.inc#L540-L543
@ahoppen ahoppen requested a review from bnbarham as a code owner October 14, 2024 22:13
@ahoppen
Copy link
Member Author

ahoppen commented Oct 14, 2024

@swift-ci Please test

@ahoppen
Copy link
Member Author

ahoppen commented Oct 15, 2024

Closing in favor of #222

@ahoppen ahoppen closed this Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants