147 lines
8.2 KiB
ReStructuredText
147 lines
8.2 KiB
ReStructuredText
===========================================
|
|
Libc++ 22.0.0 (In-Progress) Release Notes
|
|
===========================================
|
|
|
|
.. contents::
|
|
:local:
|
|
:depth: 2
|
|
|
|
Written by the `Libc++ Team <https://libcxx.llvm.org>`_
|
|
|
|
.. warning::
|
|
|
|
These are in-progress notes for the upcoming libc++ 22.0.0 release.
|
|
Release notes for previous releases can be found on
|
|
`the Download Page <https://releases.llvm.org/download.html>`_.
|
|
|
|
Introduction
|
|
============
|
|
|
|
This document contains the release notes for the libc++ C++ Standard Library,
|
|
part of the LLVM Compiler Infrastructure, release 22.0.0. Here we describe the
|
|
status of libc++ in some detail, including major improvements from the previous
|
|
release and new feature work. For the general LLVM release notes, see `the LLVM
|
|
documentation <https://llvm.org/docs/ReleaseNotes.html>`_. All LLVM releases may
|
|
be downloaded from the `LLVM releases web site <https://llvm.org/releases/>`_.
|
|
|
|
For more information about libc++, please see the `Libc++ Web Site
|
|
<https://libcxx.llvm.org>`_ or the `LLVM Web Site <https://llvm.org>`_.
|
|
|
|
Note that if you are reading this file from a Git checkout or the
|
|
main Libc++ web page, this document applies to the *next* release, not
|
|
the current one. To see the release notes for a specific release, please
|
|
see the `releases page <https://llvm.org/releases/>`_.
|
|
|
|
What's New in Libc++ 22.0.0?
|
|
==============================
|
|
|
|
Implemented Papers
|
|
------------------
|
|
|
|
- P2321R2: ``zip`` (`Github <https://llvm.org/PR105169>`__) (The paper is partially implemented. ``zip_transform_view``
|
|
and `adjacent_view` are implemented in this release)
|
|
- P2988R12: ``std::optional<T&>`` (`Github <https://llvm.org/PR148131>`__)
|
|
- P3044R2: sub-``string_view`` from ``string`` (`Github <https://llvm.org/PR148140>`__)
|
|
- P3223R2: Making ``std::istream::ignore`` less surprising (`Github <https://llvm.org/PR148178>`__)
|
|
- P3060R3: Add ``std::views::indices(n)`` (`Github <https://llvm.org/PR148175>`__)
|
|
- P2404R3: Move-only types for ``equality_comparable_with``, ``totally_ordered_with``, and ``three_way_comparable_with``
|
|
(`Github <https://llvm.org/PR105210>`__)
|
|
- P2641R4: Checking if a ``union`` alternative is active (``std::is_within_lifetime``)
|
|
(`Github <https://llvm.org/PR105381>`__)
|
|
- P2835R7: Expose ``std::atomic_ref``'s object address (`Github <https://llvm.org/PR118377>`__)
|
|
- P2944R3: Comparisons for ``reference_wrapper`` (`Github <https://llvm.org/PR105424>`__)
|
|
- P3168R2: Give ``std::optional`` Range Support (`Github <https://llvm.org/PR105430>`__)
|
|
- P3567R2: ``flat_meow`` Fixes (`Github <https://llvm.org/PR162022>`__)
|
|
|
|
Improvements and New Features
|
|
-----------------------------
|
|
|
|
- The performance of ``map::map(const map&)`` has been improved up to 2.3x
|
|
- The performance of ``map::operator=(const map&)`` has been improved by up to 11x
|
|
- The performance of ``unordered_set::unordered_set(const unordered_set&)`` has been improved by up to 3.3x.
|
|
- The performance of ``unordered_set::operator=(const unordered_set&)`` has been improved by up to 5x.
|
|
- The performance of ``map::erase`` and ``set::erase`` has been improved by up to 2x
|
|
- The performance of ``find(key)`` in ``map``, ``set``, ``multimap`` and ``multiset`` has been improved by up to 2.3x
|
|
- Some reallocations are now avoided in `std::filesystem::path::lexically_relative`, resulting in a performance
|
|
improvement of up to 1.7x.
|
|
- The performance of the ``(iterator, iterator)`` constructors of ``map``, ``set``, ``multimap`` and ``multiset``
|
|
has been improved by up to 3x
|
|
- The performance of ``insert(iterator, iterator)`` of ``map``, ``set``, ``multimap`` and ``multiset`` has been improved
|
|
by up to 2.5x
|
|
- The performance of ``erase(iterator, iterator)`` in the unordered containers has been improved by up to 1.9x
|
|
- The performance of ``map::insert_or_assign`` has been improved by up to 2x
|
|
- ``ofstream::write`` has been optimized to pass through large strings to system calls directly instead of copying them
|
|
in chunks into a buffer.
|
|
- Multiple internal types have been refactored to use ``[[no_unique_address]]``, resulting in faster compile times and
|
|
reduced debug information.
|
|
|
|
- The performance of ``std::find`` has been improved by up to 2x for integral types
|
|
- The ``std::distance`` and ``std::ranges::distance`` algorithms have been optimized for segmented iterators (e.g.,
|
|
``std::join_view`` iterators), reducing the complexity from ``O(n)`` to ``O(n / segment_size)``. Benchmarks show
|
|
performance improvements of over 1600x in favorable cases with large segment sizes (e.g., 1024).
|
|
- The ``std::{fill, fill_n}`` and ``std::ranges::{fill, fill_n}`` algorithms have been optimized for segmented iterators,
|
|
resulting in a performance improvement of at least 10x for ``std::deque<int>`` iterators and
|
|
``std::join_view<std::vector<std::vector<int>>>`` iterators.
|
|
- The ``std::{generate, generate_n}`` and ``std::ranges::generate_n`` algorithms have been optimized for segmented
|
|
iterators, resulting in a performance improvement for ``std::deque<short>`` and
|
|
``std::join_view<vector<vector<short>>>`` iterators.
|
|
- ``std::atomic::wait`` has been refactored to accept more types to use platform native wait functions directly.
|
|
This is guarded behind the ABI Macro ``_LIBCPP_ABI_ATOMIC_WAIT_NATIVE_BY_SIZE``.
|
|
- The performance of ``vector<bool>::reserve()`` has been improved by up to 2x.
|
|
|
|
- ``std::for_each`` and ``ranges::for_each`` have been optimized to iterate more efficiently over the associative
|
|
containers, resulting in performance improvements of up to 2x.
|
|
|
|
- The ``num_get::do_get`` integral overloads have been optimized, resulting in a performance improvement of up to 2.8x.
|
|
|
|
- The performance of ``std::align`` has been improved by making it an inline function, which allows the compiler to
|
|
better optimize calls to it.
|
|
|
|
Deprecations and Removals
|
|
-------------------------
|
|
|
|
Potentially breaking changes
|
|
----------------------------
|
|
|
|
- The algorithm for ``multi{map,set}::find`` has been modified such that it doesn't necessarily return an iterator to
|
|
the first equal element in the container. This was never guaranteed by the Standard, but libc++ previously happened to
|
|
always return the first equal element, like other implementations do. Starting with this release, code relying on the
|
|
first element being returned from ``find`` will be broken, and ``lower_bound`` or ``equal_range`` should be used
|
|
instead.
|
|
|
|
- The ABI flag ``_LIBCPP_ABI_NO_REVERSE_ITERATOR_SECOND_MEMBER`` has been split off from
|
|
``_LIBCPP_ABI_NO_ITERATOR_BASES``. If you are using this flag and care about ABI stability, you should set
|
|
``_LIBCPP_ABI_NO_REVERSE_ITERATOR_SECOND_MEMBER`` as well.
|
|
|
|
Announcements About Future Releases
|
|
-----------------------------------
|
|
|
|
ABI Affecting Changes
|
|
---------------------
|
|
|
|
- The ABI flag ``_LIBCPP_ABI_NO_REVERSE_ITERATOR_SECOND_MEMBER`` has been split off from
|
|
``_LIBCPP_ABI_NO_ITERATOR_BASES``. If you are using this flag and care about ABI stability, you should set
|
|
``_LIBCPP_ABI_NO_REVERSE_ITERATOR_SECOND_MEMBER`` as well.
|
|
|
|
- The internal types ``__map_value_compare``, ``__unordered_map_hasher``, ``__unordered_map_equal``,
|
|
``__hash_map_hasher`` and ``__hash_map_equal`` have been refactored to use ``_LIBCPP_COMPRESSED_ELEMENT`` instead of
|
|
potentially inheriting from the types they wrap. At this point in time we are not aware of any ABI changes caused by
|
|
this.
|
|
|
|
- ``std::align`` is now implemented as an inline function and its definition is removed from the
|
|
libc++ built library in ABI v2, or when the ``_LIBCPP_ABI_DO_NOT_EXPORT_ALIGN`` ABI configuration is enabled.
|
|
|
|
- ``ranges::iota_view`` is now aware of ``__int128``. This causes ``iota_view::difference_type`` to change from
|
|
``long long`` to ``__int128`` in some cases.
|
|
|
|
- ``std::allocator`` is now trivially default constructible. The behaviour can be reverted by defining
|
|
``_LIBCPP_DEPRECATED_ABI_NON_TRIVIAL_ALLOCATOR``. Please inform the libc++ team if you need this flag, since it will
|
|
be removed in LLVM 24 if there is no evidence that it's required.
|
|
|
|
- ``bitset::operator[]`` now returns ``bool``, making libc++ conforming. The behaviour can be reverted by defining
|
|
``_LIBCPP_DEPRECATED_ABI_BITSET_CONST_SUBSCRIPT_RETURN_REF``. Please inform the libc++ team if you need this flag,
|
|
since it will be removed in LLVM 24 if there is no evidence that it's required.
|
|
|
|
Build System Changes
|
|
--------------------
|