Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
63786ba
Toolset update: VS 2022 17.14 Preview 7 (#5512)
StephanTLavavej May 17, 2025
c86725a
Add arm64EC pipeline (#5492)
cpplearner May 17, 2025
b214da0
Vectorize `search` for 32-bit and 64-bit elements, also improve 8-bit…
AlexGuteniev May 17, 2025
d6155d4
`vector_algorithms.cpp`: further cleanup (#5485)
AlexGuteniev May 17, 2025
2ce34fd
Benchmark vectorized `reverse` and `reverse_copy`, use traits, optimi…
AlexGuteniev May 17, 2025
e9912d8
`<regex>`: Cache bitmasks of negated character classes during matchin…
muellerj2 May 17, 2025
0992807
`<regex>`: Reject empty repetitions when required by regex grammars (…
muellerj2 May 17, 2025
dfceace
`<__msvc_string_view.hpp>`: Avoid redundant forwarding in `char_trait…
frederick-vs-ja May 17, 2025
c8ae40b
Use `_Verify_ranges_do_not_overlap` in more places (#5495)
AlexGuteniev May 17, 2025
c6c64d3
Use the `_Transparent` concept and remove `_Is_transparent` (#5498)
frederick-vs-ja May 17, 2025
2eb069f
Avoid calling `memcpy` in `swap` (#5500)
AlexGuteniev May 17, 2025
ad4bf41
`<mdspan>`: Implement missing precondition in `layout_stride::mapping…
JMazurkiewicz May 17, 2025
e2f43c5
`stl/CMakeLists.txt`: Remove redundant `Synchronization.lib` (#5496)
StephanTLavavej May 17, 2025
6de3f1c
Win10 baseline: Drop support for Win8.1 / Server 2012 R2 (#5510)
StephanTLavavej May 17, 2025
2391e5e
`<regex>`: Improve search performance for regexes with initial `+` qu…
muellerj2 May 17, 2025
cbd091e
Vectorize `rotate` better (#5502)
AlexGuteniev May 17, 2025
97f5f76
Merge branch 'main' into merge-flat_map
StephanTLavavej May 17, 2025
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
16 changes: 11 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

cmake_minimum_required(VERSION 3.30.0)
cmake_minimum_required(VERSION 3.31.0)

set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
project(msvc_standard_libraries LANGUAGES CXX)

if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "19.44.35109.1")
message(FATAL_ERROR "The STL must be built with VS 2022 17.14 Preview 3 or later.")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "19.44.35207.1")
message(FATAL_ERROR "The STL must be built with VS 2022 17.14 Preview 7 or later.")
endif()

include(CheckCXXSourceCompiles)
Expand All @@ -27,7 +27,7 @@ endif()

string(TOLOWER "${VCLIBS_TARGET_ARCHITECTURE}" VCLIBS_TARGET_ARCHITECTURE)

if(VCLIBS_TARGET_ARCHITECTURE MATCHES "^x64$|^x86$")
if(VCLIBS_TARGET_ARCHITECTURE MATCHES "^(x86|x64)$")
enable_language(ASM_MASM)
endif()

Expand Down Expand Up @@ -67,7 +67,7 @@ elseif(VCLIBS_TARGET_ARCHITECTURE STREQUAL "x64")
set(VCLIBS_I386_OR_AMD64 "amd64")
set(VCLIBS_X86_OR_X64 "x64")
add_compile_definitions(_AMD64_ _VCRT_WIN32_WINNT=0x0501 _STL_WIN32_WINNT=0x0501)
elseif(VCLIBS_TARGET_ARCHITECTURE STREQUAL "armv7")
elseif(VCLIBS_TARGET_ARCHITECTURE MATCHES "^(arm|armv7)$")
set(VCLIBS_TARGET_ARCHITECTURE "arm")
set(VCLIBS_I386_OR_AMD64 "arm")
set(VCLIBS_X86_OR_X64 "arm")
Expand Down Expand Up @@ -108,6 +108,12 @@ if(STL_USE_ANALYZE)
# LPARAM is a LONG_PTR (intptr_t), and it's invalid to apply _In_opt_ to a non-pointer.
# As of the Windows 11 SDK (10.0.22621.0), there are 5 total occurrences of warning C6553 affecting the STL's build.
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:/analyze:autolog-;/wd6553>")

if(VCLIBS_TARGET_ARCHITECTURE STREQUAL "arm64ec")
# TRANSITION, the Windows SDK emits "warning C28301: No annotations for first declaration of 'meow'"
# for various intrinsics when building for ARM64EC.
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:/wd28301>")
endif()
endif()

set(VCLIBS_DEBUG_OPTIONS "$<$<COMPILE_LANGUAGE:CXX>:/Od>")
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,15 @@ Just try to follow these rules, so we can spend more time fixing bugs and implem

# How To Build With The Visual Studio IDE

1. Install Visual Studio 2022 17.14 Preview 3 or later.
1. Install Visual Studio 2022 17.14 Preview 7 or later.
* Select "Windows 11 SDK (10.0.22621.0)" in the VS Installer.
* Select "MSVC v143 - VS 2022 C++ ARM64/ARM64EC build tools (Latest)" in the VS Installer
if you would like to build the ARM64/ARM64EC target.
* Select "MSVC v143 - VS 2022 C++ ARM build tools (Latest)" in the VS Installer
if you would like to build the ARM target.
* We recommend selecting "C++ CMake tools for Windows" in the VS Installer.
This will ensure that you're using supported versions of CMake and Ninja.
* Otherwise, install [CMake][] 3.30.0 or later, and [Ninja][] 1.12.1 or later.
* Otherwise, install [CMake][] 3.31.0 or later, and [Ninja][] 1.12.1 or later.
* Make sure [Python][] 3.13 or later is available to CMake.
2. Open Visual Studio, and choose the "Clone or check out code" option. Enter the URL of this repository,
`https://github.com/microsoft/STL`.
Expand All @@ -160,15 +160,15 @@ Just try to follow these rules, so we can spend more time fixing bugs and implem

# How To Build With A Native Tools Command Prompt

1. Install Visual Studio 2022 17.14 Preview 3 or later.
1. Install Visual Studio 2022 17.14 Preview 7 or later.
* Select "Windows 11 SDK (10.0.22621.0)" in the VS Installer.
* Select "MSVC v143 - VS 2022 C++ ARM64/ARM64EC build tools (Latest)" in the VS Installer
if you would like to build the ARM64/ARM64EC target.
* Select "MSVC v143 - VS 2022 C++ ARM build tools (Latest)" in the VS Installer
if you would like to build the ARM target.
* We recommend selecting "C++ CMake tools for Windows" in the VS Installer.
This will ensure that you're using supported versions of CMake and Ninja.
* Otherwise, install [CMake][] 3.30.0 or later, and [Ninja][] 1.12.1 or later.
* Otherwise, install [CMake][] 3.31.0 or later, and [Ninja][] 1.12.1 or later.
* Make sure [Python][] 3.13 or later is available to CMake.
2. Open a command prompt.
3. Change directories to a location where you'd like a clone of this STL repository.
Expand Down
2 changes: 2 additions & 0 deletions azure-devops/asan-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ stages:
parameters:
hostArch: x64
targetArch: x64
targetPlatform: x64
asanBuild: true
testTargets: STL-ASan-CI

Expand All @@ -40,6 +41,7 @@ stages:
parameters:
hostArch: x86
targetArch: x86
targetPlatform: x86
asanBuild: true
testTargets: STL-ASan-CI

Expand Down
6 changes: 5 additions & 1 deletion azure-devops/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ parameters:
type: string
- name: targetArch
type: string
- name: targetPlatform
type: string
- name: analyzeBuild
type: boolean
default: false
Expand All @@ -28,7 +30,7 @@ parameters:
type: boolean
default: false
jobs:
- job: '${{ parameters.targetArch }}'
- job: '${{ parameters.targetPlatform }}'
strategy:
parallel: ${{ parameters.numShards }}
timeoutInMinutes: 30
Expand All @@ -53,6 +55,7 @@ jobs:
parameters:
hostArch: ${{ parameters.hostArch }}
targetArch: ${{ parameters.targetArch }}
targetPlatform: ${{ parameters.targetPlatform }}
analyzeBuild: ${{ parameters.analyzeBuild }}
asanBuild: ${{ parameters.asanBuild }}
buildBenchmarks: ${{ parameters.buildBenchmarks }}
Expand All @@ -61,5 +64,6 @@ jobs:
parameters:
hostArch: ${{ parameters.hostArch }}
targetArch: ${{ parameters.targetArch }}
targetPlatform: ${{ parameters.targetPlatform }}
testTargets: ${{ parameters.testTargets }}
skipTesting: ${{ parameters.skipTesting }}
4 changes: 4 additions & 0 deletions azure-devops/cmake-configure-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ parameters:
type: string
- name: targetArch
type: string
- name: targetPlatform
type: string
- name: analyzeBuild
type: boolean
- name: asanBuild
Expand Down Expand Up @@ -36,6 +38,7 @@ steps:
-DSTL_USE_ANALYZE=${{ parameters.analyzeBuild }} ^
-DSTL_ASAN_BUILD=${{ parameters.asanBuild }} ^
-DTESTS_BUILD_ONLY=${{ parameters.testsBuildOnly }} ^
-DVCLIBS_TARGET_ARCHITECTURE=${{ parameters.targetPlatform }} ^
-S $(Build.SourcesDirectory) -B "$(buildOutputLocation)"
displayName: 'Configure the STL'
timeoutInMinutes: 2
Expand All @@ -57,6 +60,7 @@ steps:
-DCMAKE_CXX_COMPILER=cl ^
-DCMAKE_BUILD_TYPE=Release ^
-DSTL_BINARY_DIR="$(buildOutputLocation)" ^
-DVCLIBS_TARGET_ARCHITECTURE=${{ parameters.targetPlatform }} ^
-S $(Build.SourcesDirectory)/benchmarks -B "$(benchmarkBuildOutputLocation)"
displayName: 'Configure the benchmarks'
timeoutInMinutes: 2
Expand Down
2 changes: 1 addition & 1 deletion azure-devops/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

variables:
- name: poolName
value: 'StlBuild-2025-04-16T1328-Pool'
value: 'StlBuild-2025-05-16T0735-Pool'
readonly: true
- name: poolDemands
value: 'EnableSpotVM -equals false'
Expand Down
2 changes: 1 addition & 1 deletion azure-devops/provision-image.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ foreach ($workload in $VisualStudioWorkloads) {
}

# https://github.com/PowerShell/PowerShell/releases/latest
$PowerShellUrl = 'https://github.com/PowerShell/PowerShell/releases/download/v7.5.0/PowerShell-7.5.0-win-x64.msi'
$PowerShellUrl = 'https://github.com/PowerShell/PowerShell/releases/download/v7.5.1/PowerShell-7.5.1-win-x64.msi'
$PowerShellArgs = @('/quiet', '/norestart')

$PythonUrl = 'https://www.python.org/ftp/python/3.13.3/python-3.13.3-amd64.exe'
Expand Down
6 changes: 4 additions & 2 deletions azure-devops/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ parameters:
type: string
- name: targetArch
type: string
- name: targetPlatform
type: string
- name: testTargets
type: string
- name: skipTesting
Expand All @@ -28,8 +30,8 @@ steps:
searchFolder: $(buildOutputLocation)
testResultsFormat: JUnit
testResultsFiles: '**/test-results.xml'
testRunTitle: 'test-${{ parameters.targetArch }}-$(System.JobPositionInPhase)'
testRunTitle: 'test-${{ parameters.targetPlatform }}-$(System.JobPositionInPhase)'
- publish: $(buildOutputLocation)/test-results.xml
artifact: '${{ parameters.targetArch }}-$(System.JobPositionInPhase)-xml-$(System.JobId)'
artifact: '${{ parameters.targetPlatform }}-$(System.JobPositionInPhase)-xml-$(System.JobId)'
condition: and(failed(), not(${{ parameters.skipTesting }}))
displayName: 'Publish XML Artifact'
27 changes: 26 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

# Build STL targeting x86, x64, arm, arm64
# Build STL targeting x86, x64, arm, arm64, arm64ec

variables:
- template: azure-devops/config.yml
Expand Down Expand Up @@ -29,6 +29,7 @@ stages:
parameters:
hostArch: x64
targetArch: x64
targetPlatform: x64
analyzeBuild: true
buildBenchmarks: true
numShards: 1
Expand All @@ -45,6 +46,7 @@ stages:
parameters:
hostArch: x86
targetArch: x86
targetPlatform: x86
analyzeBuild: true
buildBenchmarks: true
numShards: 1
Expand All @@ -61,6 +63,7 @@ stages:
parameters:
hostArch: x64
targetArch: arm
targetPlatform: arm
analyzeBuild: true
numShards: 1
skipTesting: true
Expand All @@ -76,18 +79,36 @@ stages:
parameters:
hostArch: x64
targetArch: arm64
targetPlatform: arm64
analyzeBuild: true
buildBenchmarks: true
numShards: 1
skipTesting: true

- stage: Early_Build_ARM64EC
dependsOn: []
displayName: 'Early Build ARM64EC'
pool:
name: ${{ variables.poolName }}
demands: ${{ variables.poolDemands }}
jobs:
- template: azure-devops/build-and-test.yml
parameters:
hostArch: x64
targetArch: arm64
targetPlatform: arm64ec
analyzeBuild: true
numShards: 1
skipTesting: true

- stage: Build_And_Test_x64
dependsOn:
- Code_Format
- Early_Build_x64
- Early_Build_x86
- Early_Build_ARM
- Early_Build_ARM64
- Early_Build_ARM64EC
displayName: 'Build and Test x64'
pool:
name: ${{ variables.poolName }}
Expand All @@ -97,6 +118,7 @@ stages:
parameters:
hostArch: x64
targetArch: x64
targetPlatform: x64

- stage: Build_And_Test_x86
dependsOn: Build_And_Test_x64
Expand All @@ -109,6 +131,7 @@ stages:
parameters:
hostArch: x86
targetArch: x86
targetPlatform: x86

- stage: Build_And_Test_ARM
dependsOn: Build_And_Test_x64
Expand All @@ -121,6 +144,7 @@ stages:
parameters:
hostArch: x64
targetArch: arm
targetPlatform: arm
testsBuildOnly: true

- stage: Build_And_Test_ARM64
Expand All @@ -134,4 +158,5 @@ stages:
parameters:
hostArch: x64
targetArch: arm64
targetPlatform: arm64
testsBuildOnly: true
7 changes: 5 additions & 2 deletions benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

cmake_minimum_required(VERSION 3.30.0)
cmake_minimum_required(VERSION 3.31.0)
project(msvc_standard_libraries_benchmarks LANGUAGES CXX)

if(DEFINED STL_BINARY_DIR)
Expand All @@ -23,7 +23,7 @@ if(DEFINED STL_BINARY_DIR)
set(VCLIBS_I386_OR_AMD64 "i386")
elseif(VCLIBS_TARGET_ARCHITECTURE STREQUAL "x64")
set(VCLIBS_I386_OR_AMD64 "amd64")
elseif(VCLIBS_TARGET_ARCHITECTURE STREQUAL "armv7")
elseif(VCLIBS_TARGET_ARCHITECTURE MATCHES "^(arm|armv7)$")
set(VCLIBS_I386_OR_AMD64 "arm")
elseif(VCLIBS_TARGET_ARCHITECTURE STREQUAL "arm64")
set(VCLIBS_I386_OR_AMD64 "arm64")
Expand Down Expand Up @@ -116,8 +116,11 @@ add_benchmark(nth_element src/nth_element.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(regex_search src/regex_search.cpp)
add_benchmark(remove src/remove.cpp)
add_benchmark(replace src/replace.cpp)
add_benchmark(reverse src/reverse.cpp)
add_benchmark(rotate src/rotate.cpp)
add_benchmark(search src/search.cpp)
add_benchmark(search_n src/search_n.cpp)
add_benchmark(std_copy src/std_copy.cpp)
Expand Down
38 changes: 38 additions & 0 deletions benchmarks/src/regex_search.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Copyright (c) Microsoft Corporation.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#include <benchmark/benchmark.h>
#include <regex>
#include <string>

#include "lorem.hpp"

using namespace std;

void bm_lorem_search(benchmark::State& state, const char* pattern) {
string repeated_lorem{lorem_ipsum};
for (long long i = 0; i < state.range(); ++i) {
repeated_lorem += repeated_lorem;
}
regex re{pattern};

for (auto _ : state) {
benchmark::DoNotOptimize(repeated_lorem);
const char* pos = repeated_lorem.data();
const char* end = repeated_lorem.data() + repeated_lorem.size();
cmatch match;
for (; regex_search(pos, end, match, re); ++pos) {
benchmark::DoNotOptimize(match);
pos = match[0].second;
if (pos == end) {
break;
}
}
}
}

BENCHMARK_CAPTURE(bm_lorem_search, "bibe", "bibe")->Arg(2)->Arg(3)->Arg(4);
BENCHMARK_CAPTURE(bm_lorem_search, "(bibe)+", "(bibe)+")->Arg(2)->Arg(3)->Arg(4);
BENCHMARK_CAPTURE(bm_lorem_search, "(?:bibe)+", "(?:bibe)+")->Arg(2)->Arg(3)->Arg(4);

BENCHMARK_MAIN();
Loading