fmtlib/fmt
View on GitHub ↗ ★ 25,901 C++
A modern formatting library
53 mentions on Hacker News by 32 people: 9 stories, 44 comments · first 2015-02-10 · latest 2026-05-13
20082026
-
u can type in crow.toml something like [dependencies] fmt = { git = " https://github.com/fmtlib/fmt " }. crow will clone the repo and will try to find crow.toml in it. cant find? so, crow will use wheels (from the word "wheelchair". it's…
comment by anybodyy · 2026-05-13 · in I made Rust’s cargo copy but for CPP -
…{alias = "fmt"}) add_requires("vcpkg::fmt", {alias = "fmt"}) add_requires("git://github.com/fmtlib/fmt v11.0.2", {alias = "fmt"}) target("myapp") set_kind("binary") add_files("src/*.cpp") add_packages("fmt") Then you use it like #
comment by gavinray · 2026-04-09 · in Show HN: I built a Cargo-like build tool for C/C++ -
It is possible to compress the table using the technique from Dragonbox ( https://github.com/fmtlib/fmt/blob/8b8fccdad40decf68687ec038... ) at the cost of some perf. It's on my TODO list for zmij.
comment by vitaut · 2026-01-24 · in Floating-Point Printing and Parsing Can Be Simple and Fast -
…but it's possible to compress them to hundreds of bytes using the method from the Dragonbox paper ( https://github.com/fmtlib/fmt/blob/a6e871e39b835e5f87c5f5627... ) at the cost of some performance.
comment by vitaut · 2025-12-04 · in Schubfach: The smallest floating point double-to-string impleme -
…addition to FILE's buffer. If you are interested in what {fmt} is doing, a good starting point is https://github.com/fmtlib/fmt/blob/35dcc58263d6b55419a5932bd... . It is also possible to bypass stdio completely and get even faster output (…
comment by vitaut · 2025-07-20 · in Stdio(3) change: FILE is now opaque -
…at fmtlib/fmt, which APIs treat FILE as non-opaque? Edit: ah, found some of the magic, I think: https://github.com/fmtlib/fmt/blob/35dcc58263d6b55419a5932bd... I'm curious how much speedup is gained from this.
comment by Retr0id · 2025-07-20 · in Stdio(3) change: FILE is now opaque -
…general, it is a bad practice. However, it can be useful for some low-level libraries. For example, https://github.com/fmtlib/fmt provides a type-safe replacement for `printf` that can write directly to the FILE buffer providing comparable…
comment by vitaut · 2025-07-20 · in Stdio(3) change: FILE is now opaque -
…in seconds: zyn new my_project cd my_project Add dependencies directly from Git: zyn install https://github.com/fmtlib/fmt.git@9.1.0 Run it fast, run it clean: zyn run --release Why Zyn? Unlike legacy build systems, Zyn keeps things…
comment by zyntraxis · 2025-05-17 -
it's probably not chrome because they are using this third party library: ( https://github.com/fmtlib/fmt ). also, it might be that this sink is actually meant to write a message to the console but due to configuration options its a noop.…
comment by benmmurphy · 2025-01-08 · in How is my Browser blocking RWX execution? -
Some people are noticing that println is very new. But there already is https://github.com/fmtlib/fmt and it has been there quite a long time.
comment by cjfd · 2024-12-05 · in Move semantics in Rust, C++, and Hylo -
It was emulated using horrible macros: https://github.com/fmtlib/fmt/blob/8f5e07656e25ec64ec7c843f0... . IIRC some early versions of `std::tuple` did something similar.
comment by vitaut · 2024-10-21 · in The C23 edition of Modern C -
…for C++20 and https://en.cppreference.com/w/cpp/io/print for C++23 https://github.com/fmtlib/fmt is what it's based on, for C++11 and up support.
comment by steveklabnik · 2024-10-16 · in The C23 edition of Modern C -
…thanks! Fixed now. This explains why the difference was kinda low compared to another benchmark: https://github.com/fmtlib/fmt?tab=readme-ov-file#compile-tim... .
comment by vitaut · 2024-01-07 · in Optimizing the unoptimizable: a journey to faster C++ compile times -
…fastest numeric formatting and I/O: * https://vitaut.net/posts/2020/fast-int-to-string-revisited/ * https://github.com/fmtlib/fmt/pull/1882 * https://vitaut.net/posts/2020/optimal-file-buffer-size/ Here's just one example:…
comment by vitaut · 2023-12-27 · in The C++20 Naughty and Nice List for Game Devs -
…heavily optimized for build speed and is usually faster to compile than equivalent iostream code: https://github.com/fmtlib/fmt?tab=readme-ov-file#compile-tim... . Once modularized std is available we might be able to be compete with…
comment by vitaut · 2023-12-27 · in The C++20 Naughty and Nice List for Game Devs -
…for older compilers, or to use some more cutting-edge features that haven't been standardized yet, https://github.com/fmtlib/fmt is available to you.
comment by steveklabnik · 2023-12-26 · in Learn Modern C++ -
{fmt} has internal buffering but it's not yet exposed to users. There is a feature request for it: https://github.com/fmtlib/fmt/issues/2354 . FILE buffering is not too bad but it can be easily optimized:…
comment by vitaut · 2023-12-07 · in For processing strings, streams in C++ can be slow -
…is an incoming way out of that with work of Victor Zverovich on std::format and libfmt [1]. [1]: https://github.com/fmtlib/fmt
comment by adev_ · 2023-12-07 · in For processing strings, streams in C++ can be slow -
…string processing code which works on "raw" data in memory buffers. If convenience matters look at https://github.com/fmtlib/fmt (or std::format which AFAIK is less feature rich) and https://github.com/imageworks/pystring .
comment by flohofwoe · 2023-12-07 · in For processing strings, streams in C++ can be slow -
I like C much more than C++, but even with that must say that https://github.com/fmtlib/fmt is pretty nice (which is the base for std::format). Together with pystring ( https://github.com/imageworks/pystring ) it makes string processing in…
comment by flohofwoe · 2023-12-07 · in For processing strings, streams in C++ can be slow -
…with my pretty up-to-date compilers (testing Debian bookworm gcc/clang right now). There is only https://github.com/fmtlib/fmt but it doesn't seem prepackaged for me. Have you actually used std::format_to_n? Did you go through the trouble…
comment by jstimpfle · 2023-07-13 · in C++23: The Next C++ Standard -
…aren't complete, even though <format> is C++20. The recommended way to get those headers is to grab https://github.com/fmtlib/fmt as an external library... Talk about the level of hype and lack of pragmatism that's going on around here.…
comment by jstimpfle · 2023-07-13 · in C++23: The Next C++ Standard -
…to great lengths to avoid them and I agree with them. print/println are based on the fmt library ( https://github.com/fmtlib/fmt ), which had it's first release in 2015, so it's roughly as old as Rust afaik. It's mainly inspired by Python…
comment by dxuh · 2023-07-11 · in C++23: The Next C++ Standard -
fmtlib ( https://github.com/fmtlib/fmt ), a C++11 formatting library that was the basis for C++20 std::format, is able to do this.
comment by otherjason · 2023-01-17 · in Rust vs. C++ Formatting -
…libs mentioned 1)fmt and 2)sdl2. Let's go with that. Usually all libs have version tags associated: https://github.com/fmtlib/fmt/releases/tag/9.1.0 https://github.com/libsdl-org/SDL/releases/tag/release-2.24.... Rust Cargo.toml files help…
comment by omac777 · 2022-09-28 · in Why is it that C++ package managers are unnecessarily hard? – or are they? -
http://tmplbook.com/ and study the source code of some good-quality open source project, for example https://github.com/fmtlib/fmt/ and this could be also handy: https://en.cppreference.com/w/cpp/meta
comment by pajko · 2022-09-21 · in Ask HN: Best path/resource to learn modern C++ in 2022? -
…have a significant user base. 1: https://lists.llvm.org/pipermail/llvm-dev/2020-June/142300.h... 2: https://github.com/fmtlib/fmt/pull/2190
comment by bla3 · 2021-03-28 · in Preview: IBM z/OS v2.5 [pdf] -
…which one can learn including: https://github.com/skypjack/entt https://github.com/taocpp/PEGTL https://github.com/fmtlib/fmt
comment by Sheeplator · 2021-02-07 · in Ask HN: C++17/C++20 example projects with good style? -
strtod is not a good benchmark. Is it faster than std::format or https://github.com/fmtlib/fmt ?
comment by greg7mdp · 2021-02-02 · in Fastfloat – C++ library 4x faster than strtod -
…speed between printf, std::format and C++ iostream. The last one is monomophization, I believe. https://github.com/fmtlib/fmt#compile-time-and-code-bloat
comment by bicolao · 2021-01-04 · in Rust is now overall faster than C in benchmarks -
…over cstdio. Orthodox C++ would ban this but you can have both printf-style with type safety with https://github.com/fmtlib/fmt Which inspired C++20's std::format: https://en.cppreference.com/w/cpp/utility/format Which is also banned by…
comment by kllrnohj · 2020-12-28 · in Orthodox C++ -
…And it's not reliant on the compiler doing its own magic checking outside of the language. [1] https://github.com/fmtlib/fmt
comment by quietbritishjim · 2020-08-14 · in Implementing a Type-safe printf in Rust -
…fast_io gives 15% perf improvement by replacing a safe format_int API from https://github.com/fmtlib/fmt with a similar but unsafe one + 50kB of extra data. Adding safety will likely bring perf down which the last line seems to confi
comment by vitaut · 2020-05-26 · in I/O library 6x faster than fmt, 10x faster than stdio.h and iostream -
…With iostreams there are no format strings so there is nothing to validate. Libraries such as https://github.com/fmtlib/fmt are allow to do compile-time parsing of the string though.
comment by jcelerier · 2020-03-30 · in What If C++ Abandoned Backward Compatibility? -
Interesting side note: https://github.com/fmtlib/fmt of the same author has been aded to the C++20 standard. One of the few inclusions into the standard which (IMHO) can be universally considered to be a good thing. If you're coming from…
comment by flohofwoe · 2019-07-31 · in Reducing printf call overhead with variadic templates -
I stopped using `<<` for the most part after I discovered the excellent fmt library[1]. [1] https://github.com/fmtlib/fmt
comment by umvi · 2019-07-03 · in D as a C Replacement -
FWIW {fmt} already supports formatting of containers, tuples and ranges as of version 5.0 ( https://github.com/fmtlib/fmt/releases/tag/5.0.0 ), for example: #include <fmt/ranges.h> std::vector<int> v = {1, 2, 3}; fmt::print("{}", v); //…
comment by vitaut · 2019-05-01 · in Pprint: Pretty Printer for Modern C++ -
…your python & rust equivalents. Speaking as a python evangelist who uses C++ out of nece$$ity. [1] https://github.com/fmtlib/fmt
comment by klyrs · 2018-12-23 · in C++20 Ranges -
…loop, you can use boost::irange for(auto i: irange(0,10)){ For the output stuff, you can use fmt ( https://github.com/fmtlib/fmt/blob/master/README.rst ) which is on track for standardization. fmt::print("{} {} {} ", a,b,c); Overall most…
comment by RcouF1uZ4gsC · 2018-05-05 · in CPY – Code C/C++ with no redundancy -
…several implementations. The fastest itoa I’ve found was fmt::FormatInt class from there https://github.com/fmtlib/fmt Based on the article, I think fmtlib will be faster than what they did here.
comment by Const-me · 2017-12-24 · in How to Print Integers Really Fast -
…formatting syntax, which also happens to generate much smaller binaries than Boost.Format. [1] https://github.com/fmtlib/fmt
comment by aldanor · 2017-12-19 · in The Complete Guide to Building Strings in C++ -
Also C++ has Python-like formatting: https://github.com/fmtlib/fmt . Disclaimer: I'm the author of this library.
comment by vitaut · 2016-05-01 · in C++ Has Become More Pythonic (2014) -
Thanks for the suggestions. There has been some work to make formatting more customizable ( https://github.com/cppformat/cppformat/issues/235 ). This will enable extensions like the ones you suggest while keeping the library itself lean.…
comment by vitaut · 2016-01-09 · in How to C in 2016 -
…which is quite unreadable to say the least. To address this issue I even wrote a small library ( https://github.com/cppformat/cppformat ) that allows you to write something like this instead: print("Local number: {}\n\n", someIntPtr); It…
comment by vitaut · 2016-01-08 · in How to C in 2016