@vitaut

Jason talked about THE THING....

https://www.youtube.com/watch?v=TreruByxQWE

What was the "forward declare" trick? You had a blog article about that?

You may wish to comment under Jason's video and even get him to make a video about the workaround.

And we should pressure the Vendors to improve their QoI, IMHO.

C++ Weekly - Ep 523 - Why I'm Still Using std::cout (on this channel)

YouTube
@oschonrock which thing?

@vitaut

compile time and binary size of the stdlib implementations of format and print.

watch the video.. it's only 7mins

@oschonrock That's a known problem, I even opened an issue: https://github.com/llvm/llvm-project/issues/163002. I would suggest using {fmt} until it is fixed.
Massive binary bloat in std::print · Issue #163002 · llvm/llvm-project

Consider the following trivial program (std-print.cc): #include <print> int main() { std::print("{}\n", 42); } Compiling it with libc++ and Apple clang version 17.0.0 (clang-1700.3.19.1) on macOS r...

GitHub

@vitaut

yes, I am aware.

I just thought Jason covering it, would be good opportunity to broaden awareness of the real cause of the issue (QoI) and that we can hopefully expect improvements.

stdlibc++ needs to follow suit...
waiting for MSVC might take a long time.

@oschonrock @vitaut

C'mon Oliver, you can do better and check the facts first:

https://godbolt.org/z/aszhcjcPe

Compiler Explorer - C++

auto main() -> int { std::print("Hello world!"); }

@DanielaKEngert @vitaut

OK Dani, I stand corrected. 🫡

Bloat is gone. How is the speed?
CE link was cached, and not sure how to turn it off.

So does @vitaut 's theory apply?

Will the other Vendors be shamed into fixing their QoI?

@oschonrock @vitaut
@lefticus

Simply change the source a bit, e.g. like so:

https://godbolt.org/z/M944r3z19

Tested right now (twice):
MSVC came back after 1-2 seconds,
Clang after 2-3 seconds,
GCC took forever.

Compiler Explorer - C++

auto main() -> int { std::print("Hello world!"); return 2; }

@DanielaKEngert @vitaut @lefticus

I got similar proportions, but twice as slow for all..

then I tried std::cout <<

clang & MSVC were fastest, about 40% faster than MSVC was on std::print. GCC's std::cout speed was comparable to MSVC's std::print...

But clearly CE is not a repeatable platform for these sorts of tests, nor is this "sample of one" methodology any good.

@DanielaKEngert would you say MSVC std::print speed approaches std::cout?

@oschonrock @vitaut @lefticus

Testing speed in CE is more or less futile unless you want to get a first ballpark impression.

Regarding your std::print vs. std::cout question: what is your objective?

- compile throughput?
- runtime performance?
- something else?

In our codebase, not throwing because of stooopid errors is paramount. We switched to fmt::format about a decade ago, and moved on to std::format during the VS2019 time frame - without any regrets due to noticeable build time increases.

@DanielaKEngert @vitaut @lefticus

For me the compile time is the main issue.

But if you switched the whole code base and noticed little difference, that is a decent reference point.

I have tried that on gcc and clang several times and had to revert, the slowdown was too painful.

And that is the point here.
The current compile times on those 2 implementations, of what is an important foundational feature, makes it borderline unusable in practice.

(binary bloat also important for some)

@oschonrock @vitaut @lefticus

I totally agree.

With regards to compile time: some may argue that I made it even worse with my compile time checking of the singular *and* plural format strings (i.e. support for internationalization at runtime) plus some additional consistency features. No sweat doing so 😊