[all-commits] [llvm/llvm-project] 3efe35: [libc++][format] Implements P3107R5 in <print>.

Mark de Wever via All-commits all-commits at lists.llvm.org
Tue Mar 11 12:17:43 PDT 2025


  Branch: refs/heads/users/mordante/P3107R5-implementation
  Home:   https://github.com/llvm/llvm-project
  Commit: 3efe358f31aa13267142dd40a0eb7f401ba65794
      https://github.com/llvm/llvm-project/commit/3efe358f31aa13267142dd40a0eb7f401ba65794
  Author: Mark de Wever <koraq at xs4all.nl>
  Date:   2025-03-11 (Tue, 11 Mar 2025)

  Changed paths:
    M libcxx/docs/ReleaseNotes/21.rst
    M libcxx/include/__format/buffer.h
    M libcxx/include/print
    M libcxx/modules/std/print.inc
    M libcxx/test/libcxx/system_reserved_names.gen.py
    M libcxx/test/libcxx/transitive_includes/cxx03.csv
    M libcxx/test/libcxx/transitive_includes/cxx11.csv
    M libcxx/test/libcxx/transitive_includes/cxx14.csv
    M libcxx/test/libcxx/transitive_includes/cxx17.csv
    M libcxx/test/libcxx/transitive_includes/cxx23.csv
    M libcxx/test/libcxx/transitive_includes/cxx26.csv

  Log Message:
  -----------
  [libc++][format] Implements P3107R5 in <print>.

The followup paper P3235R3 which is voted in as a DR changes the names
foo_locking to foo_buffered. These changes have been applied in this
patch.

Before
-------------------------------------------------------
Benchmark             Time             CPU   Iterations
-------------------------------------------------------
printf             71.3 ns         71.3 ns      9525175
print_string        226 ns          226 ns      3105850
print_stack         232 ns          232 ns      3026498
print_direct        530 ns          530 ns      1318447

After
-------------------------------------------------------
Benchmark             Time             CPU   Iterations
-------------------------------------------------------
printf             70.6 ns         70.6 ns      9789585
print_string        222 ns          222 ns      3147678
print_stack         227 ns          227 ns      3084767
print_direct        474 ns          474 ns      1472786

Note: The performance of libc++'s std::print is still extemely slow
compared to printf. Based on P3107R5 std::print should outperform
printf. The main culprit is the call to isatty, which is resolved
after implementing
LWG4044  Confusing requirements for std::print on POSIX platforms

Implements
- P3107R5 - Permit an efficient implementation of ``std::print``

Implements parts of
- P3235R3 std::print more types faster with less memory

Fixes: #105435



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list