-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
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
Proposal: Switch from strftime to internal implementation for locale independent formats #2541
Comments
|
C and C++ locales are not compatible in Windows? I was unable to get the same output for I plan to write performance tests in the next few days. Now all locale independent formats are implemented without |
Other prototype for fast time formatting from @toughengineer (https://github.com/toughengineer/fmt, toughengineer@3ae5d81) |
Perfomance test: @vitaut, |
If you plan to stop using
What's the policy regarding compatibility with |
These cases are GNU extensions. POSIX and MSVC The C and C++ standard defines a limited set of supported formats. |
To clarify my earlier comment, currently the documentation says:
which means that I should be able to use whatever format features supported by "the system’s |
@vitaut, what do you think about this? |
Ideally we shouldn't use |
Ideally, but has a problem On Windows
My possible suggestion in PR #2544 description: 2 way processing with failback to Questions for working on PR #2544:
If need, failback to a single Questions about migrate to Lines 291 to 292 in dcd282b
format time always to UTF-8 string. do_write function is used in detail::chrono_formatter which can work with wchar_t . wchar_t tests for this case are missing.Maybe there is an error in this code and conversion to UTF-8 should be performed only for char ?
|
|
If non-standard specs are not needed to be supported and each format spec should be processed individually, why not use locale facet instead of |
Is speed in |
That's the plan.
Yes.
Definitely and thank you for doing this. Are you referring to #2543?
There is a limit, we probably don't want to go very platform-specific. |
No, I made a PoC and was wondering if that's something of interest for this library.
Not platform specific, no JIT, just pure C++ (hopefully even without UB). |
PR is welcome! |
* Fix unicode test * Add xchar support to chrono formatter * Replace strftime with std::time_put * Add std::locale support to std::tm formatter * Use predefined names and formats for C-locale * Performance improvement * Make locale-independent and C locale formats consistent among platforms
Implementation of the idea:
My implementation
https://github.com/phprus/fmt/tree/optimize-tm-formatting-3
Functions https://github.com/phprus/fmt/blob/6c13ec65d06c5c0bba7806a01252179ae76cb1c9/include/fmt/chrono.h#L1545-L1576
can be optimized.
Performance
Not tested yet.
Problem
I don't know why, but on Windows the
detail::write
( https://github.com/phprus/fmt/blob/6c13ec65d06c5c0bba7806a01252179ae76cb1c9/include/fmt/chrono.h#L364-L369 ) function works with a different locale thanstrftime
.The text was updated successfully, but these errors were encountered: