-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enhancements for
<filesystem>
(#3850)
Co-authored-by: A. Jiang <de34@live.cn> Co-authored-by: Stephan T. Lavavej <stl@nuwen.net>
- Loading branch information
1 parent
85eb9b6
commit f6401b1
Showing
3 changed files
with
95 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
#include <benchmark/benchmark.h> | ||
#include <filesystem> | ||
#include <string_view> | ||
|
||
namespace { | ||
void BM_lexically_normal(benchmark::State& state) { | ||
using namespace std::literals; | ||
static constexpr std::wstring_view args[5]{ | ||
LR"(X:DriveRelative)"sv, | ||
LR"(\\server\\\share)"sv, | ||
LR"(STL/.github/workflows/../..)"sv, | ||
LR"(C:\Program Files\Azure Data Studio\resources\app\extensions\bat\snippets\batchfile.code-snippets)"sv, | ||
LR"(/\server/\share/\a/\b/\c/\./\./\d/\../\../\../\../\../\../\../\other/x/y/z/.././..\meow.txt)"sv, | ||
}; | ||
|
||
const auto index = state.range(0); | ||
const std::filesystem::path p(args[index]); | ||
for (auto _ : state) { | ||
benchmark::DoNotOptimize(p.lexically_normal()); | ||
} | ||
} | ||
} // namespace | ||
|
||
BENCHMARK(BM_lexically_normal)->DenseRange(0, 4, 1); | ||
|
||
BENCHMARK_MAIN(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters