mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-30 18:49:00 +08:00
e79f0dc532
I added benchmarks to measure how fast the parallel remove_all code was -- it turns out, about 3x slower than stdfs::remove_all. Since this was the case, I removed all of the parallelism and rewrote it serially, and ended up about 30% faster than stdfs::remove_all (in addition to supporting symlinks). In addition, I did the following three orthogonal changes: - simplified the work queue, basing it on Billy O'Neal's idea - Fix warnings on older versions of compilers in tests, by splitting the pragmas out of pch.h. - Ran clang-format on some files In fixing up remove_all, the following changes were made: - On Windows, regular symlinks and directory symlinks are distinct; as an example, to remove directory symlinks (and junctions, for that matter), one must use RemoveDirectory. Only on Windows, I added new `file_type` and `file_status` types, with `file_type` including a new `directory_symlink` enumerator, and `file_status` being exactly the same as the old one except using the new `file_type`. On Unix, I didn't make that change since they don't make a distinction. - I added new `symlink_status` and `status` functions which use the new `file_status` on Windows. - I made `Filesystem::exists` call `fs::exists(status(p))`, as opposed to the old version which called `stdfs::exists` directly. - Added benchmarks to `vcpkg-test/files.cpp`. They test the performance of `remove_all` on small directories (~20 files), with symlinks and without, and on large directories (~2000 files), with symlinks and without.
62 lines
1.1 KiB
C++
62 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include <vcpkg/pragmas.h>
|
|
|
|
#if defined(_WIN32)
|
|
#define NOMINMAX
|
|
#define WIN32_LEAN_AND_MEAN
|
|
|
|
#pragma warning(suppress : 4768)
|
|
#include <windows.h>
|
|
|
|
#pragma warning(suppress : 4768)
|
|
#include <Shlobj.h>
|
|
|
|
#include <process.h>
|
|
#include <shellapi.h>
|
|
#include <winhttp.h>
|
|
#else
|
|
#include <unistd.h>
|
|
#endif
|
|
|
|
#include <algorithm>
|
|
#include <array>
|
|
#include <atomic>
|
|
#include <cassert>
|
|
#include <cctype>
|
|
#include <chrono>
|
|
#include <codecvt>
|
|
#include <cstdarg>
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
#define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING
|
|
#include <cstring>
|
|
#include <experimental/filesystem>
|
|
#include <fstream>
|
|
#include <functional>
|
|
#include <iomanip>
|
|
#include <iostream>
|
|
#include <iterator>
|
|
#include <map>
|
|
#include <memory>
|
|
#include <mutex>
|
|
#include <random>
|
|
#include <regex>
|
|
#include <set>
|
|
#include <stdexcept>
|
|
#include <string>
|
|
#if defined(_WIN32)
|
|
#include <sys/timeb.h>
|
|
#else
|
|
#include <sys/time.h>
|
|
#endif
|
|
#include <sys/types.h>
|
|
#include <system_error>
|
|
#include <thread>
|
|
#include <time.h>
|
|
#include <type_traits>
|
|
#include <unordered_map>
|
|
#include <unordered_set>
|
|
#include <utility>
|
|
#include <vector>
|