![]() Requesting multiple files asynchronously can be much faster than doing a synchronous loop waiting for each block to be received so to then request a new block. Still, the speed of HDD is mostly bound by the huge seek time and the hierarchy of searched files is nearly never contiguous on most modern file systems (though there is a cache to avoid many fetches).įor solid-state drive (SSD), this is more complex: the time to fetch a block is far smaller but it still has a significant latency. However, a good OS stack can cleverly prioritize the operation regarding the location of the head in real time and the location of the blocks to be fetched. Indeed, they are inherently sequential mainly due to the magnetic head and the spinning disk. This is often generally true for hard disk drive (HDD). This is mainly dependent of the hardware and the operating system (OS) stack (file system, drivers, actual OS, etc.). Is there any trick to faster iteration and summing up file sizes than how my implementation does it? I don't think that "clever multi-threading" will provide such a huge benefit since disk accesses can't really be multi-threaded for a huge performance gain.ĭisk accesses can't really be multi-threaded for a huge performance gain However, running this code even in optimized builds is significantly slower than what TreeSize can do (e.g. Assuming I wanted to calculate a folder size efficiently in C++, I would for example use the following modern C++ code: size_t calculate_directory_size(const std::filesystem::path& directory, const size_t maximum_size)įor (std::filesystem::recursive_directory_iterator directory_iterator(directory) ĭirectory_iterator != std::filesystem::recursive_directory_iterator() ++directory_iterator) I'm wondering how they're doing this so fast. You can redistribute and/or modify it under the terms of the GNU Public License, version 2 (GPLv2).The program TreeSize Free can list folders inside a directory and sort them descendingly according to their file sizes to find the biggest folders/files for cleaning up your harddrive. The cushion shading additionally brings out the directory structure. ![]() The color of a rectangle indicates the type of the file, as shown in the extension list. So their area is proportional to the size of the subtrees. The rectangles are arranged in such a way, that directories again make up rectangles, which contain all their files and subdirectories. The treemap represents each file as a colored rectangle, the area of which is proportional to the file's size. The extension list, which serves as a legend and shows statistics about the file types. ![]()
0 Comments
Leave a Reply. |