Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
f6580c2
[vector.bool] Optimize copy / move algorithms (#3353)
miscco Sep 21, 2023
ddebb7b
Implement debug-enabled `formatter` specializations (#3913)
JMazurkiewicz Sep 21, 2023
4047639
Bugfixes for `<any>` (#3965)
achabense Sep 21, 2023
acb342c
Cleanups for `condition_variable`'s waiting functions (#3974)
achabense Sep 21, 2023
2ae7622
Fix `deque`'s usage of `_Allocate_at_least_helper` (#4017)
achabense Sep 21, 2023
e934ec1
extract code format validation into a new template (#4029)
CaseyCarter Sep 21, 2023
1c928ac
Tolerate 80-bit `long double` in `<xlocnum>` (#4032)
StephanTLavavej Sep 21, 2023
11c8fc3
Document `_Ref_fn`'s *raison d'etre* (#4036)
CaseyCarter Sep 21, 2023
a577749
`<mdspan>`: Fixes signed overflow in `_Fwd_prod_of_extents` (#4037)
MattStephanson Sep 21, 2023
73ef31b
Require VS 2022 17.8, remove workaround (#4039)
StephanTLavavej Sep 21, 2023
4f97dbb
`<future>` cleanups (#3940)
achabense Sep 21, 2023
939513b
Update preprocessor `#else` and `#endif` comment (#3950)
AlexGuteniev Sep 21, 2023
6f31505
Cleanups and enhancements for `basic_string` (#3984)
achabense Sep 21, 2023
61cc2a5
Avoid unconditional `make_heap` for `priority_queue::push_range` (#4025)
achabense Sep 21, 2023
69ceca3
Fix the `_Choose_pocca_v` branch in `basic_string::operator=(const&)`…
achabense Sep 21, 2023
7ffed1d
Cleanups for `<deque>` part 1 (#4016)
achabense Sep 21, 2023
385f133
`<deque>`: Fix single-element insertion of `deque` (#4022)
frederick-vs-ja Sep 21, 2023
7c574c6
Merge branch 'main' into flat_set-update
StephanTLavavej Sep 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions azure-devops/format-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

# run the `validator` tool, and ensure code is properly clang-formatted

jobs:
- job: Code_Format_Validation
timeoutInMinutes: 5
displayName: 'Validation'
steps:
- script: |
if exist "$(tmpDir)" (
rmdir /S /Q $(tmpDir)
)
mkdir $(tmpDir)
displayName: 'Setup TMP Directory'
- checkout: self
clean: true
submodules: false
- script: |
cd $(Build.SourcesDirectory)
git clean --quiet -x -d -f -f
displayName: 'Clean after checkout'
- script: |
call "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\Common7\Tools\VsDevCmd.bat" ^
-host_arch=amd64 -arch=amd64 -no_logo
cmake -G Ninja -S $(Build.SourcesDirectory)/tools -B $(tmpDir)/format-validate-build
cmake --build $(tmpDir)/format-validate-build
displayName: 'Build format and validation'
timeoutInMinutes: 5
env: { TMP: $(tmpDir), TEMP: $(tmpDir) }
- script: |
call "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\Common7\Tools\VsDevCmd.bat" ^
-host_arch=amd64 -arch=amd64 -no_logo
cmake --build $(tmpDir)/format-validate-build --target run-format
displayName: 'clang-format Files'
timeoutInMinutes: 5
env: { TMP: $(tmpDir), TEMP: $(tmpDir) }
- script: |
call "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\Common7\Tools\VsDevCmd.bat" ^
-host_arch=amd64 -arch=amd64 -no_logo
cmake --build $(tmpDir)/format-validate-build --target run-validate
displayName: 'Validate Files'
timeoutInMinutes: 2
env: { TMP: $(tmpDir), TEMP: $(tmpDir) }
- task: Powershell@2
displayName: 'Create Diff'
inputs:
filePath: azure-devops/create-prdiff.ps1
pwsh: false
condition: succeededOrFailed()
env: { TMP: $(tmpDir), TEMP: $(tmpDir) }
47 changes: 1 addition & 46 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,52 +19,7 @@ stages:
- stage: Code_Format
displayName: 'Code Format'
jobs:
- job: Code_Format_Validation
timeoutInMinutes: 5
displayName: 'Validation'
steps:
- script: |
if exist "$(tmpDir)" (
rmdir /S /Q $(tmpDir)
)
mkdir $(tmpDir)
displayName: 'Setup TMP Directory'
- checkout: self
clean: true
submodules: false
- script: |
cd $(Build.SourcesDirectory)
git clean --quiet -x -d -f -f
displayName: 'Clean after checkout'
- script: |
call "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\Common7\Tools\VsDevCmd.bat" ^
-host_arch=amd64 -arch=amd64 -no_logo
cmake -G Ninja -S $(Build.SourcesDirectory)/tools -B $(tmpDir)/format-validate-build
cmake --build $(tmpDir)/format-validate-build
displayName: 'Build format and validation'
timeoutInMinutes: 5
env: { TMP: $(tmpDir), TEMP: $(tmpDir) }
- script: |
call "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\Common7\Tools\VsDevCmd.bat" ^
-host_arch=amd64 -arch=amd64 -no_logo
cmake --build $(tmpDir)/format-validate-build --target run-format
displayName: 'clang-format Files'
timeoutInMinutes: 5
env: { TMP: $(tmpDir), TEMP: $(tmpDir) }
- script: |
call "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\Common7\Tools\VsDevCmd.bat" ^
-host_arch=amd64 -arch=amd64 -no_logo
cmake --build $(tmpDir)/format-validate-build --target run-validate
displayName: 'Validate Files'
timeoutInMinutes: 2
env: { TMP: $(tmpDir), TEMP: $(tmpDir) }
- task: Powershell@2
displayName: 'Create Diff'
inputs:
filePath: azure-devops/create-prdiff.ps1
pwsh: false
condition: succeededOrFailed()
env: { TMP: $(tmpDir), TEMP: $(tmpDir) }
- template: azure-devops/format-validation.yml

- stage: Build_And_Test_x64
dependsOn: Code_Format
Expand Down
5 changes: 5 additions & 0 deletions benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,10 @@ endfunction()
add_benchmark(bitset_to_string src/bitset_to_string.cpp)
add_benchmark(locale_classic src/locale_classic.cpp)
add_benchmark(path_lexically_normal src/path_lexically_normal.cpp)
add_benchmark(priority_queue_push_range src/priority_queue_push_range.cpp)
add_benchmark(random_integer_generation src/random_integer_generation.cpp)
add_benchmark(std_copy src/std_copy.cpp)

add_benchmark(vector_bool_copy src/std/containers/sequences/vector.bool/copy/test.cpp)
add_benchmark(vector_bool_copy_n src/std/containers/sequences/vector.bool/copy_n/test.cpp)
add_benchmark(vector_bool_move src/std/containers/sequences/vector.bool/move/test.cpp)
89 changes: 89 additions & 0 deletions benchmarks/src/priority_queue_push_range.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
// Copyright (c) Microsoft Corporation.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#include <algorithm>
#include <benchmark/benchmark.h>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <queue>
#include <random>
#include <span>
#include <string>
#include <string_view>
#include <vector>
using namespace std;

namespace {
constexpr size_t vec_size = 10'000;

template <class T, class Fn>
auto create_vec(Fn transformation) {
vector<T> vec(vec_size);
for (mt19937_64 rnd(1); auto& e : vec) {
e = transformation(rnd());
}
return vec;
}

template <class T>
T cast_to(uint64_t val) {
return static_cast<T>(val);
}

const auto vec_u8 = create_vec<uint8_t>(cast_to<uint8_t>);
const auto vec_u16 = create_vec<uint16_t>(cast_to<uint16_t>);
const auto vec_u32 = create_vec<uint32_t>(cast_to<uint32_t>);
const auto vec_u64 = create_vec<uint64_t>(cast_to<uint64_t>);
const auto vec_float = create_vec<float>(cast_to<float>);
const auto vec_double = create_vec<double>(cast_to<double>);

const auto vec_str = create_vec<string>([](uint64_t val) { return to_string(static_cast<uint32_t>(val)); });
const auto vec_wstr = create_vec<wstring>([](uint64_t val) { return to_wstring(static_cast<uint32_t>(val)); });

template <class T, const auto& Data>
void BM_push_range(benchmark::State& state) {
const size_t frag_size = static_cast<size_t>(state.range(0));

for (auto _ : state) {
priority_queue<T> que;
span spn{Data};

while (!spn.empty()) {
const size_t take_size = min(spn.size(), frag_size);
que.push_range(spn.first(take_size));
spn = spn.subspan(take_size);
}
benchmark::DoNotOptimize(que);
}
}

template <size_t L>
void putln(const benchmark::State&) {
static bool b = [] {
puts("");
return true;
}();
}
} // namespace

#define TEST_PUSH_RANGE(T, source) \
BENCHMARK(BM_push_range<T, source>) \
->Setup(putln<__LINE__>) \
->RangeMultiplier(100) \
->Range(1, vec_size) \
->Arg(vec_size / 2 + 1);

TEST_PUSH_RANGE(uint8_t, vec_u8);
TEST_PUSH_RANGE(uint16_t, vec_u16);
TEST_PUSH_RANGE(uint32_t, vec_u32);
TEST_PUSH_RANGE(uint64_t, vec_u64);
TEST_PUSH_RANGE(float, vec_float);
TEST_PUSH_RANGE(double, vec_double);

TEST_PUSH_RANGE(string_view, vec_str);
TEST_PUSH_RANGE(string, vec_str);
TEST_PUSH_RANGE(wstring_view, vec_wstr);
TEST_PUSH_RANGE(wstring, vec_wstr);

BENCHMARK_MAIN();
100 changes: 100 additions & 0 deletions benchmarks/src/std/containers/sequences/vector.bool/copy/test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
// Copyright (c) Microsoft Corporation.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#include <benchmark/benchmark.h>
//
#include <algorithm>
#include <random>
#include <vector>

using namespace std;

static vector<bool> createRandomVector(const size_t size) {
static mt19937 gen{random_device{}()};
vector<bool> result(size);
generate_n(result.begin(), size, [] { return bernoulli_distribution{0.5}(gen); });
return result;
}

static void copy_block_aligned(benchmark::State& state) {
const auto size = state.range(0);
const vector<bool> source = createRandomVector(size);
vector<bool> dest(size, false);

for (auto _ : state) {
copy(source.cbegin(), source.cend(), dest.begin());
}
}

static void copy_source_misaligned(benchmark::State& state) {
const auto size = state.range(0);
const vector<bool> source = createRandomVector(size);
vector<bool> dest(size, false);

for (auto _ : state) {
copy(source.cbegin() + 1, source.cend(), dest.begin());
}
}

static void copy_dest_misaligned(benchmark::State& state) {
const auto size = state.range(0);
const vector<bool> source = createRandomVector(size);
vector<bool> dest(size, false);

for (auto _ : state) {
copy(source.cbegin(), source.cend() - 1, dest.begin() + 1);
}
}

// Special benchmark for matching char alignment
static void copy_matching_alignment(benchmark::State& state) {
const auto size = state.range(0);
const vector<bool> source = createRandomVector(size);
vector<bool> dest(size, false);

for (auto _ : state) {
copy(source.cbegin() + 5, source.cend(), dest.begin() + 5);
}
}

// Special benchmarks for single block corner case
static void copy_both_single_blocks(benchmark::State& state) {
const vector<bool> source = createRandomVector(50);
vector<bool> dest(50, false);

const size_t length = 20;
for (auto _ : state) {
copy(source.cbegin() + 5, source.cbegin() + 5 + length, dest.begin() + 5);
}
}

static void copy_source_single_block(benchmark::State& state) {
const vector<bool> source = createRandomVector(50);
vector<bool> dest(50, false);

const size_t length = 20;
for (auto _ : state) {
copy(source.cbegin() + 5, source.cbegin() + 5 + length, dest.begin() + 25);
}
}

static void copy_dest_single_block(benchmark::State& state) {
const vector<bool> source = createRandomVector(50);
vector<bool> dest(50, false);

const size_t length = 20;
for (auto _ : state) {
copy(source.cbegin() + 25, source.cbegin() + 25 + length, dest.begin() + 5);
}
}

BENCHMARK(copy_block_aligned)->RangeMultiplier(64)->Range(64, 64 << 10);
BENCHMARK(copy_source_misaligned)->RangeMultiplier(64)->Range(64, 64 << 10);
BENCHMARK(copy_dest_misaligned)->RangeMultiplier(64)->Range(64, 64 << 10);
BENCHMARK(copy_matching_alignment)->RangeMultiplier(64)->Range(64, 64 << 10);

BENCHMARK(copy_both_single_blocks);
BENCHMARK(copy_source_single_block);
BENCHMARK(copy_dest_single_block);

BENCHMARK_MAIN();
Loading