3 ms·
For those interested, here's the actual code Chen talks about: https://github.com/tongzx/nt5src/blob/daad8a087a4e75422ec96b7911f1df4669989611/Source/XPSP1/NT/sh
by EMIRELADERO 25d ago
For those interested, here's the actual code Chen talks about: https://github.com/tongzx/nt5src/blob/daad8a087a4e75422ec96b7911f1df4669989611/Source/XPSP1/NT/shell/shell32/userpict.cpp#L458 https://github.com/tongzx/nt5src/blob/daad8a087a4e75422ec96b...
- Sopel 25d agoI don't see how this is supposedly more efficient than the easier approach of listing all files and choosing a single random number in 1..n
- bonzini 25d agoYou have to allocate memory and free it. Interestingly, when reading Raymond Chen's article I thought "reservoir sampling would compare the random number (between 1 and n) to 1, not to n, because that extends more easily to picking more than one element" - and that's what the actual Windows code uses.
- Sopel 24d agoyes, you would have to allocate space for up to 100 file paths, but the article says > it’s more efficient because it reduces the amount of calls into the file system, which is where the bottleneck is Upon reading it a few times I think the article is alluding to a crappy two-pass solution where you don't store a filename but instead an index into a directory, which is flawed anyway due to being racy.
- ycuser2 25d agoDidn't know that NT5 source is available for the public. Why Microsoft does not ban/delete it on GitHub?
- lr0 25d agoThey are usually deleted, maybe this one hasn't got popular enough yet.
- Philpax 25d agoIt's been around for six years; at this point, I imagine any damage it could have done has been done already.
- sph 25d agoIt'll pop up elsewhere so might as well keep it online on their servers. And it's an old version of the OS anyway. If it were the Windows 11 source, it'd get nuked immediately
- VCFundedGenYer 25d ago> And it's an old version of the OS anyway. Most modern Windows code was written in 1995. Don't assume for one moment that it isn't in production Win11 today.
- kevin_thibedeau 24d agoYou can still get windows 3 directory picker dialogs in obscure places like the ODBC data source utility.
- Sophira 24d agoYou can even still get error messages referencing the CONFIG.SYS file, which hasn't been relevant for well over two decades at this point: https://www.reddit.com/r/sysadmin/comments/1wctbf3/throwback_to_the_90s/ https://www.reddit.com/r/sysadmin/comments/1wctbf3/throwback...
- downrightmike 24d agoWhy remove things, storage is only getting cheaper /s