We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The std::error_code has are operator<< (https://en.cppreference.com/w/cpp/error/error_code/operator_ltlt), which is equivalent os << ec.category().name() << ':' << ec.value() .
std::error_code
operator<<
os << ec.category().name() << ':' << ec.value()
Formatting with ostream is 4-5 (C++11) or 11-24 (C++17) times slower than the custom formatter class.
Simpe and possibly incorrect implementation: https://github.com/phprus/fmt-bench/blob/format-error_code/test_formatter.cpp (I agree that this code are licensed under the {fmt} license, and agree to future changes to the licensing.) Benchmark (https://github.com/phprus/fmt-bench/tree/format-error_code):
Running ./fmt_test Run on (8 X 2700 MHz CPU s) CPU Caches: L1 Data 32 KiB (x4) L1 Instruction 32 KiB (x4) L2 Unified 256 KiB (x4) L3 Unified 6144 KiB (x1) Load Average: 1.79, 1.73, 1.69 ----------------------------------------------------------------- Benchmark Time CPU Iterations ----------------------------------------------------------------- FMTIostream/22 369 ns 368 ns 1953098 FMTIostreamCompile/22 385 ns 384 ns 1863938 FMTFormatter/22 75.9 ns 75.8 ns 9392947 FMTFormatterCompile/22 79.6 ns 79.5 ns 8838830
Running ./fmt_test Run on (8 X 2700 MHz CPU s) CPU Caches: L1 Data 32 KiB (x4) L1 Instruction 32 KiB (x4) L2 Unified 256 KiB (x4) L3 Unified 6144 KiB (x1) Load Average: 1.68, 1.71, 1.69 ----------------------------------------------------------------- Benchmark Time CPU Iterations ----------------------------------------------------------------- FMTIostream/22 389 ns 388 ns 1854806 FMTIostreamCompile/22 380 ns 378 ns 1794761 FMTFormatter/22 33.7 ns 33.7 ns 20944226 FMTFormatterCompile/22 16.4 ns 16.4 ns 42452029
The text was updated successfully, but these errors were encountered:
Seems like a good idea, could you submit a PR?
Sorry, something went wrong.
Yes, but I'm not sure if my implementation is correct.
I don't know how to write the parse method correctly to follow the logic of the library.
parse
I'm not sure if my implementation is correct.
Looks OK to me. You could simplify parse by just returning ctx.begin().
ctx.begin()
PR: #2270
No branches or pull requests
The
std::error_code
has areoperator<<
(https://en.cppreference.com/w/cpp/error/error_code/operator_ltlt), which is equivalentos << ec.category().name() << ':' << ec.value()
.Formatting with ostream is 4-5 (C++11) or 11-24 (C++17) times slower than the custom formatter class.
Simpe and possibly incorrect implementation: https://github.com/phprus/fmt-bench/blob/format-error_code/test_formatter.cpp (I agree that this code are licensed under the {fmt} license, and agree to future changes to the licensing.)
Benchmark (https://github.com/phprus/fmt-bench/tree/format-error_code):
AppleClang 11.0.0.11000033 C++11
AppleClang 11.0.0.11000033 C++17
The text was updated successfully, but these errors were encountered: