Comments (2)
Thanks for your comments.
The results for the int-generator benchmark, which BTW is taken from Karma, that you give are similar to the ones I reported in http://zverovich.net/2013/09/07/integer-to-string-conversion-in-cplusplus.html .
Boost Karma is indeed pretty fast, but unfortunately it doesn't support replacement-based formatting. So it is not surprising that it is faster than fmt::Format
which in addition to formatting also performs parsing of a format string and handling of positional arguments. Therefore it make more sense comparing Karma to fmt::Writer
rather than to fmt::Format
.
As you can see fmt::Writer
is slightly faster than karma::generate
on the original benchmark although it does automatic buffer management while Karma uses a fixed buffer. I'll have a look why allocating additional std::string
causes larger performance impact with fmt::Writer
than with Karma, but the main point is that with fmt::Writer
you usually don't need this allocation, because the buffer management is automatic.
fmt::FormatInt
works with int64_t
now.
As for the modified benchmark, as far as I understand it compares the performance of formatting of single-digit and double-digit numbers. Since formatting of such small numbers is very fast, the buffer management that fmt::Writer
does becomes a significant factor. Karma on the other hand offloads the buffer management to the user. Anyway, even for small inputs fmt::FormatInt
is somewhat faster than karma::generate
:
% 10
results:
karma::generate: 0.0991358 [s]
fmt::FormatInt: 0.0979277 [s]
% 100
results:
karma::generate: 0.0997507 [s]
fmt::FormatInt: 0.0943652 [s]
from fmt.
BTW where is this library page that you've mentioned?
from fmt.
Related Issues (20)
- Does not compile with the FMT_PEDANTIC=ON and FMT_WERROR=ON options HOT 3
- Add support for alternative month format HOT 2
- P3142R0: Printing Blank Lines with println HOT 1
- MSVC errors when importing both fmt and std modules HOT 19
- Cannot use ostream support on fmt 9.x and 10.x HOT 1
- fmt::format_to + FMT_STRING with wide characters fails to compile HOT 1
- Invalid PDB file generated due to MSVC 2017 compatibility code HOT 6
- std::chrono::current_zone() is not meant to return the local time zone HOT 4
- It would be good to have a customizable separator in fmt::group_digits(...) HOT 1
- fmt::styled and fmt::formatter<std::string> parse deactivate colors/termaps HOT 1
- formatting of variant types HOT 3
- FMT_USE_NONTYPE_TEMPLATE_ARGS detection is wrong on trunk HOT 2
- Support for a single `char` separator in `fmt::join()` HOT 1
- Formatting for strings with custom allocators fails to compile HOT 2
- Advice for extending libfmt for GPU support? HOT 2
- xchar.h extra dependencies HOT 1
- cannot use in CUDA (+MSVC) for newest branch master HOT 1
- Question: what's the difference between string-like formatters and where are they defined? HOT 2
- fmt won't let me specialize a formatter to format mixed character types. HOT 2
- `fmt::isnan` triggers floating-point exception for NaN values HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fmt.