"NTFS really isn't that bad" - Robert Collins (LCA 2020)
linux.conf.au5 HN recommenders · recommended in 3 months, 2020–2025
talk · advanced · evergreen · 2020–2025 on HN
Robert Collins explains why rustup installs were painfully slow on Windows and how changes to rustup and Windows cut install time from 3m30s to 14s. The talk covers NTFS, small files and the cost of antivirus hooks on file close.
The go-to reference for why file operations are slow on Windows and how antivirus filters, not NTFS itself, are the cause.
Up next
6 mo on HNThe Man Who Accidentally Killed The Most People In History
Veritasium
6 HN recommender · 2022–2026
3 mo on HNHow We Made MuseScore 4 - Music App Design is Challenging!
Tantacrul
4 HN recommender · 2022–2026
5 mo on HNHow I Designed a Free Music Font for 5 Million Musicians (MuseScore 3.6)
Tantacrul
5 HN recommender · 2021–2024
16 mo on HNHow Python was Shaped by leaky Internals, Armin Ronacher, Flask framework
Видео с мероприятий {speach!
15 HN recommender · 2017–2025
11 mo on HNCppCon 2015: Andrei Alexandrescu “std::allocator...”
CppCon
7 HN recommender · 2017–2025
12 mo on HNPreventing the Collapse of Civilization / Jonathan Blow (Thekla, Inc)
DevGAMM
14 HN recommender · 2020–2025
10 mo on HN"Performance Matters" by Emery Berger
Strange Loop Conference
12 HN recommender · 2019–2025
11 mo on HNThe Thirty Million Line Problem
Molly Rocket
11 HN recommender · 2018–2024
10 mo on HNCppCon 2017: Matt Kulukundis “Designing a Fast, Efficient, Cache-friendly Hash Table, Step by Step”
CppCon
9 HN recommender · 2018–2026
10 mo on HNErlang Factory 2014 - That's 'Billion' with a 'B': Scaling to the Next Level at WhatsApp
Erlang Solutions
6 HN recommender · 2014–2022
9 mo on HNHow Crash Bandicoot Hacked The Original Playstation | War Stories | Ars Technica
Ars Technica
13 HN recommender · 2020–2026
9 mo on HN"How NOT to Measure Latency" by Gil Tene
Strange Loop Conference
9 HN recommender · 2015–2026
12 comments from Hacker News
And as a result of this, if you want to optimize your program to be fast on Windows, you will make very different optimization decisions than on other platforms. For example, Windows runs virus scans on close(), which makes it very slow. This means that sometimes it makes sense to have one or more background threads exclusively dedicated to closing files. There's a good talk on this at ▶ this video
I want to take this opportunity to recommend the talk "NTFS isn't that bad" ( ▶ this video ). NTFS prefers a different access pattern than most usual file systems. I remember that a part of the talk was about speed-ups on Linux as well. So even if it doesn't sway your opinion it should enhance your perspective on how file systems work.
That may be due to a combination of Malware detection + most unix programs not really written to take advantage of the features NTFS has to offer This is a great talk on the topic ▶ this video
NTFS can be especially awful if you're used to Linux behaviour, port code over to Windows and expect the same performance. Here's a talk on porting rustup to Windows: ▶ this video To begin with, it takes rustup 3m30s to install on Windows. After rejigging the code again and again away from its naive implementation which works fine on Linux, to perform sympathetically towards NTFS, it takes the same rustup 14s to install. That's quite a performance gain! But it needed a lot of changes to rustup, and to Windows itself.
Add your npm directories to the virus file exclusion lists of Windows Defender. Note that some of the directories may not be obvious (those under AppData for example). The speed improvements are massive for tools like these that touch lots of small files. Also take a look at this talk on NTFS, file system speed, and how the presenter optimized the Rust installer: ▶ this video . There is an awful lot that can be done to tools that deal with lots of files to perform well under Windows too.
The thinness is actually part of the problem. POSIX and Windows APIs don't work like each other. For example, if you were a Unix archiver extracting a file, you'd call stat() open() write() close() chmod() utimes(). On Linux/BSD that's 1 file open/close, but on Windows, that's 4 file opens/closes because the Windows APIs need an open filehandle, while the POSIX APIs take a filepath. Linux/BSD have LRU caches of filepath->inode because they're designed around these APIs, Windows doesn't. Cygwin has to open/close a Windows filehandle each time because it can't make the calling code pass a filehandle instead. So it may be more comfortable and familiar, but also Windows APIs are unsympathetic to code designed for Unix originally. See this talk on how the developers of rustup massively improved their performance on Windows by restructuring their code: ▶ this video
But it simply isn't slower than Linux. Robert Collins explains that performance is just as good as Linux and the performance loss on Windows is due to file system filters (Defender)[0]. This is what DevDrive intends (and does) fix. [0] ▶ this video
However, the code traverses that amount of data. It doesn't matter if you pass over the same inode n times. From OS point of view, there's no difference. Of course you can write a more complicated calculation algorithm, but it'll require tons of syscalls to determine the type of the file handle you're interacting with and will be probably very slow. This is what rustup did inadvertently back in the day, and it caused NTFS to melt down to a halt because of stat() overhead [0]. [0]: ▶ this video
to my understanding it's not really IO (reading/writing bytes), but overhead on OpenFile/CloseFile being under AV/Defender inspection. I'm taking that understanding basing on ▶ this video with " "NTFS really isn't that bad" - Robert Collins (LCA 2020) " > Why was rustup slow (3m30s to install (not including download time)) in early 2019 on Windows, and why isn't it slow (14s to install) now? >Early in 2019 I was developing some things in Rustlang on Windows, got frustrated at the performance of rustup (the installer for rust) and looked for bug. I found one which blamed a combination of NTFS, small files and anti-virus software for the problem. This wasn't an entirely satisfactory answer to my mind. Fast forward a bit, and with a combination of changes to rustup and to Windows itself and rustup is now pleasantly usable.... which also improved performance for rustup on NFS mounted home directories.
Here likely meant that system level hooks of antiviral software are invoked on CloseFile call when you do writes, not on OpenFile. You may want to take a look on ▶ this video
> Even if windows indexing aint malicious, it certainly behaves as if it is. The problem is that closing files takes a lot of time on Windows. ▶ this video
> the bottleneck is that NTFS is a crappy filesystem. Care to explain why do you think NTFS is crap? From my experience it's usually bad assumptions about files under windows and every application or library tries to stick to posix interface when dealing with files (open, read/write, close) which tends to block for longer periods on windows than on linux counterparts which results in significant perfomance loss . Linux first software will always outperform windows implementation and Windows first software will outperform Linux implementations unless you provide separate code paths to properly handle underlying OS architecture and assumptions. On Windows closing the file handle is extremely costly operation due AV checks and file content indexing [1] [1] ▶ this video