Skip to content

Commit 359b961

Browse files
committed
[libc++][format] Improves escaping.
The change increments the size of the lookup table considerably. The table has an "upper boundary" check. The removal of the code units with the property Grapheme_Extend=Yes removes the range E0100..E01EF. This breaks the trailing large continues section in two parts. This will be improved in a followup patch. Implements: - P2713R1 Escaping improvements in std::format - LWG3965 Incorrect example in [format.string.escaped] p3 for formatting of combining characters Before ----------------------------------------------------------------------- Benchmark Time CPU Iterations ----------------------------------------------------------------------- BM_ascii_escaped<char> 95696 ns 95459 ns 7341 BM_unicode_escaped<char> 89311 ns 89088 ns 7835 BM_cyrillic_escaped<char> 58633 ns 58494 ns 11964 BM_japanese_escaped<char> 44500 ns 44382 ns 15780 BM_emoji_escaped<char> 99156 ns 98911 ns 7075 BM_ascii_escaped<wchar_t> 92245 ns 92017 ns 7592 BM_unicode_escaped<wchar_t> 80970 ns 80747 ns 8651 BM_cyrillic_escaped<wchar_t> 51253 ns 51112 ns 13729 BM_japanese_escaped<wchar_t> 37252 ns 37156 ns 18758 BM_emoji_escaped<wchar_t> 96226 ns 95961 ns 7270 After ----------------------------------------------------------------------- Benchmark Time CPU Iterations ----------------------------------------------------------------------- BM_ascii_escaped<char> 110704 ns 110696 ns 6206 BM_unicode_escaped<char> 101371 ns 101374 ns 6862 BM_cyrillic_escaped<char> 63329 ns 63327 ns 11013 BM_japanese_escaped<char> 41223 ns 41225 ns 16938 BM_emoji_escaped<char> 111022 ns 111021 ns 6304 BM_ascii_escaped<wchar_t> 112441 ns 112443 ns 6231 BM_unicode_escaped<wchar_t> 102776 ns 102779 ns 6813 BM_cyrillic_escaped<wchar_t> 58977 ns 58975 ns 11868 BM_japanese_escaped<wchar_t> 36885 ns 36886 ns 18975 BM_emoji_escaped<wchar_t> 115885 ns 115881 ns 6051
1 parent 3f29228 commit 359b961

File tree

8 files changed

+1149
-960
lines changed

8 files changed

+1149
-960
lines changed

libcxx/docs/ReleaseNotes/19.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ Implemented Papers
5050
- P1659R3 - ``std::ranges::starts_with`` and ``std::ranges::ends_with``
5151
- P3029R1 - Better ``mdspan``'s CTAD
5252
- P2387R3 - Pipe support for user-defined range adaptors
53+
- P2713R1 - Escaping improvements in ``std::format``
5354

5455
Improvements and New Features
5556
-----------------------------

libcxx/docs/Status/Cxx23Papers.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
"`P2164R9 <https://wg21.link/P2164R9>`__","LWG", "``views::enumerate``","February 2023","","","|ranges|"
109109
"`P2711R1 <https://wg21.link/P2711R1>`__","LWG", "Making multi-param constructors of ``views`` ``explicit``","February 2023","|In Progress| [#note-P2711R1]_","","|ranges|"
110110
"`P2609R3 <https://wg21.link/P2609R3>`__","LWG", "Relaxing Ranges Just A Smidge","February 2023","","","|ranges|"
111-
"`P2713R1 <https://wg21.link/P2713R1>`__","LWG", "Escaping improvements in ``std::format``","February 2023","","","|format|"
111+
"`P2713R1 <https://wg21.link/P2713R1>`__","LWG", "Escaping improvements in ``std::format``","February 2023","|Complete|","19.0","|format|"
112112
"`P2675R1 <https://wg21.link/P2675R1>`__","LWG", "``format``'s width estimation is too approximate and not forward compatible","February 2023","|Complete|","17.0","|format|"
113113
"`P2572R1 <https://wg21.link/P2572R1>`__","LWG", "``std::format`` fill character allowances","February 2023","|Complete|","17.0","|format|"
114114
"`P2693R1 <https://wg21.link/P2693R1>`__","LWG", "Formatting ``thread::id`` and ``stacktrace``","February 2023","|Partial| [#note-P2693R1]_","","|format|"

libcxx/docs/Status/Cxx2cIssues.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"`3951 <https://wg21.link/LWG3951>`__","[expected.object.swap]: Using ``value()`` instead of ``has_value()``","Kona November 2023","","",""
3333
"`3953 <https://wg21.link/LWG3953>`__","``iter_move`` for ``common_iterator`` and ``counted_iterator`` should return ``decltype(auto)``","Kona November 2023","","","|ranges|"
3434
"`3957 <https://wg21.link/LWG3957>`__","[container.alloc.reqmts] The value category of v should be claimed","Kona November 2023","","",""
35-
"`3965 <https://wg21.link/LWG3965>`__","Incorrect example in [format.string.escaped] p3 for formatting of combining characters","Kona November 2023","","","|format|"
35+
"`3965 <https://wg21.link/LWG3965>`__","Incorrect example in [format.string.escaped] p3 for formatting of combining characters","Kona November 2023","|Complete|","19.0","|format|"
3636
"`3970 <https://wg21.link/LWG3970>`__","[mdspan.syn] Missing definition of ``full_extent_t`` and ``full_extent``","Kona November 2023","","",""
3737
"`3973 <https://wg21.link/LWG3973>`__","Monadic operations should be ADL-proof","Kona November 2023","","",""
3838
"`3974 <https://wg21.link/LWG3974>`__","``mdspan::operator[]`` should not copy ``OtherIndexTypes``","Kona November 2023","","",""

libcxx/docs/Status/FormatIssues.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Number,Name,Standard,Assignee,Status,First released version
1010
"`P2508R1 <https://wg21.link/P2508R1>`__","Exposing ``std::basic-format-string``","C++23","Mark de Wever","|Complete|",15.0
1111
"`P2585R0 <https://wg21.link/P2585R0>`__","Improving default container formatting","C++23","Mark de Wever","|Complete|",17.0
1212
"`P2539R4 <https://wg21.link/P2539R4>`__","Should the output of ``std::print`` to a terminal be synchronized with the underlying stream?","C++23","Mark de Wever","|Complete|","18.0"
13-
"`P2713R1 <https://wg21.link/P2713R1>`__","Escaping improvements in ``std::format``","C++23","Mark de Wever",""
13+
"`P2713R1 <https://wg21.link/P2713R1>`__","Escaping improvements in ``std::format``","C++23","Mark de Wever","|Complete|",19.0
1414
"`P2675R1 <https://wg21.link/P2675R1>`__","``format``'s width estimation is too approximate and not forward compatible","C++23","Mark de Wever","|Complete|",17.0
1515
"`P2572R1 <https://wg21.link/P2572R1>`__","``std::format`` fill character allowances","C++23","Mark de Wever","|Complete|",17.0
1616
"`P2693R1 <https://wg21.link/P2693R1>`__","Formatting ``thread::id`` and ``stacktrace``","C++23","Mark de Wever","|In Progress|"

0 commit comments

Comments
 (0)