Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
vitaut
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
6 ms
·
31.
▲
by
vitaut
10mo ago
It converts 1.0 to "1.e-01" which reminds me to remove the trailing decimal point =). dtoa-benchmark tests that the algorithm produces valid results on its dataset.
32.
▲
by
vitaut
10mo ago
Cool, please share once it is complete. C++ also provides countl_zero: https://en.cppreference.com/w/cpp/numeric/countl_zero.html . We currently use our own for maximum portability. I considered computing the
33.
▲
by
vitaut
10mo ago
It depends on the input distribution, specifically exponents. It is also possible to compress the table at the cost of additional computation using the method from Dragonbox.
34.
▲
by
vitaut
10mo ago
I am pretty sure Dragonbox is smaller than Ryu in terms of code size because it can compress the tables.
35.
▲
by
vitaut
10mo ago
Think about things like logging and all the uses of printf which are not parsed back. But I agree that parsing is extremely common, just not the same level.
36.
▲
by
vitaut
10mo ago
> Unlike formatting, correct parsing involves high precision arithmetic. Formatting also requires high precision arithmetic unless you disallow user-specified precision. That's why {fmt} still has an implementation of Dragon4 as a f
37.
▲
by
vitaut
10mo ago
Thank you! The simplicity is mostly thanks to Schubfach although I did simplify it a bit more. Unfortunately the paper makes it appear somewhat complex because of all the talk about generic bases and Java workarounds.
38.
▲
by
vitaut
10mo ago
This is possible and the trailing zeros are indeed removed (with the exponent adjusted accordingly) in the write function. The post mentions removing trailing zeros without going into details but it's a pretty interesting topic and was
39.
▲
by
vitaut
10mo ago
I've added a C implementation in https://github.com/vitaut/zmij/blob/main/zmij.c in case you are interested.
40.
▲
by
vitaut
10mo ago
Good question. I am not familiar with string-to-double algorithms but maybe it's an easier problem? double-to-string is relatively complex, people even doing PhD in this area. There is also some inherent asymmetry: formatting is more c
41.
▲
by
vitaut
10mo ago
I am not sure how it compares but I did use one idea from Cassio's talk on Teju: > A more interesting improvement comes from a talk by Cassio Neri Fast Conversion From Floating Point Numbers. In Schubfach, we look at four candidate
42.
▲
by
vitaut
10mo ago
Thank you! It means a lot coming from you, Grisu was the first algorithm that I implemented =). (I am the author of the blog post.)
43.
▲
by
vitaut
10mo ago
Tables are ~10k 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 per
44.
▲
Hardening the C++ Standard Library at massive scale
(queue.acm.org)
1 points
by
vitaut
11mo ago
|
0 comments
45.
▲
Making the Clang AST Leaner and Faster
(cppalliance.org)
50 points
by
vitaut
11mo ago
|
9 comments
46.
▲
C++ Memory Safety in WebKit [video]
(youtube.com)
3 points
by
vitaut
1y ago
|
0 comments
47.
▲
by
vitaut
1y ago
rikifmt only supports the default formatting which is somewhat limited and in the current implementation cannot even format std::string or FP numbers without data loss. Once more functionality is added the variadic template approach will qu
48.
▲
by
vitaut
1y ago
Note that {fmt} provides a lightweight API (`fmt/base.h`) with a superset of `printf` functionality and optimized for build speed ( https://vitaut.net/posts/2024/faster-cpp-compile-times/ ) and binary size
49.
▲
CLion Introduces Constexpr Debugger
(blog.jetbrains.com)
3 points
by
vitaut
1y ago
|
0 comments
50.
▲
Hardening mode for the compiler
(discourse.llvm.org)
158 points
by
vitaut
1y ago
|
54 comments
51.
▲
by
vitaut
1y ago
With fwrite that would be another level of buffering in 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/35dcc58263d6b55
52.
▲
by
vitaut
1y ago
In 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 buf
53.
▲
Revisiting Knuth's "Premature Optimization" Paper
(probablydance.com)
3 points
by
vitaut
1y ago
|
0 comments
54.
▲
How Compiler Explorer Works in 2025
(xania.org)
232 points
by
vitaut
1y ago
|
46 comments
55.
▲
Where did <random> go wrong? [video]
(youtube.com)
1 points
by
vitaut
1y ago
|
0 comments
56.
▲
Results summary: 2025 Annual C++ Developer Survey "Lite" [pdf]
(isocpp.org)
2 points
by
vitaut
1y ago
|
0 comments
57.
▲
by
vitaut
1y ago
https://www.reddit.com/r/ProgrammerHumor/comments/8nn4fw/for...
58.
▲
by
vitaut
1y ago
I made a garlic nan: https://www.godbolt.org/z/enjv1c7Tf
59.
▲
by
vitaut
1y ago
{fmt} doesn't use reflection and is optimized for build speed using type erasure: https://vitaut.net/posts/2024/faster-cpp-compile-times/
60.
▲
by
vitaut
2y ago
gRPC and Thrift are comparable in performance and there is actually an opposite trend of switching from gRPC to Thrift in the few places where the former is still used.
More ›