Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
fmt
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
fmt
Commits
58e53b43
Commit
58e53b43
authored
Dec 07, 2012
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update readme.
parent
659dd37b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
32 deletions
+34
-32
README.rst
README.rst
+34
-32
No files found.
README.rst
View file @
58e53b43
...
...
@@ -8,6 +8,7 @@ Features
* Format string syntax similar to the one used by `str.format
<http://docs.python.org/2/library/stdtypes.html#str.format>`__ in Python.
* Support for user-defined types.
* High speed: performance of the current proof-of-concept implementation
is close to that of iostreams (see `Speed tests`_).
* Small code size both in terms of source code (format consists of a single
...
...
@@ -15,12 +16,13 @@ Features
(see `Compile time and code bloat`_).
* Easy deployment: small self-contained code base, no external dependencies,
permissive license.
* Support for user-defined types.
Example
-------
Examples
--------
This prints "Hello, world!" to stdout:
fmt::Print("Hello, {0}!") << "world";
fmt::Print("Hello, {0}!") << "world";
Benchmarks
----------
...
...
@@ -28,6 +30,34 @@ Benchmarks
Compile time and code bloat
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Speed tests
~~~~~~~~~~~
The following speed tests results were generated by building
``tinyformat_test.cpp`` on Ubuntu GNU/Linux 12.10 with
``g++-4.7.2 -O3 -DSPEED_TEST -DHAVE_FORMAT``, and taking the best of three
runs. In the test, the format string ``"%0.10f:%04d:%+g:%s:%p:%c:%%\n"`` or
equivalent is filled 2000000 times with output sent to ``/dev/null``; for
further details see the `source
<https://github.com/vitaut/tinyformat/blob/master/tinyformat_test.cpp>`__.
============== ========
test name run time
============== ========
libc printf 1.26s
std::ostream 2.02s
format 2.20s
tinyformat 2.51s
boost::format 10.40s
============== ========
As you can see boost::format is much slower than the alternative methods; this
is confirmed by `other tests <http://accu.org/index.php/journals/1539>`__.
Tinyformat is quite good coming close to iostreams. Unfortunately tinyformat
cannot be faster than the iostreams because it uses them internally.
Performance of format is close to that of std::ostream but there is a room for
improvement since format is not based on iostreams.
The script ``bloat_test.sh`` from the `tinyformat
<https://github.com/c42f/tinyformat>`__ repository tests compile time and
code bloat for nontrivial projects. It generates 100 translation units
...
...
@@ -67,34 +97,6 @@ executable size is smaller with tinyformat then with format and for
non-optimized build its the other way around. Boost::format has by far
the largest overheads.
Speed tests
~~~~~~~~~~~
The following speed tests results were generated by building
``tinyformat_test.cpp`` on Ubuntu GNU/Linux 12.10 with
``g++-4.7.2 -O3 -DSPEED_TEST -DHAVE_FORMAT``, and taking the best of three
runs. In the test, the format string ``"%0.10f:%04d:%+g:%s:%p:%c:%%\n"`` or
equivalent is filled 2000000 times with output sent to ``/dev/null``; for
further details see the `source
<https://github.com/vitaut/tinyformat/blob/master/tinyformat_test.cpp>`__.
============== ========
test name run time
============== ========
libc printf 1.26s
std::ostream 2.02s
format 2.20s
tinyformat 2.51s
boost::format 10.40s
============== ========
As you can see boost::format is much slower than the alternative methods; this
is confirmed by `other tests <http://accu.org/index.php/journals/1539>`__.
Tinyformat is quite good coming close to iostreams. Unfortunately tinyformat
cannot be faster than the iostreams because it uses them internally.
Performance of format is close to that of std::ostream but there is a room for
improvement since format is not based on iostreams.
Running the tests
~~~~~~~~~~~~~~~~~
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment