Skip to content
HomeVideosBooksBlogs
AllTop postsTopics
Podcasts
HistoryListsWatch laterLiked videosFollowing

The videos, books, blogs and podcasts Hacker News keeps recommending, all in one place.

VideosBooksBlogsPodcastsAboutPrivacySettings

Data from Hacker News, HackerTube, HackerBooks, HackerBlogs and Open Library. Credits · Not affiliated with Y Combinator.

HomeVideosBooksBlogsPodcasts
Ctrl K
    V

    Victor Zverovich

    zverovich.net · Personal blog · on HN since 2015

    Victor Zverovich, author of the {fmt} C++ formatting library, who writes about C++ formatting, compile times, and performance.

    Visit blogHN submissions
    ProgrammingSystems & PerformanceLanguages & Compilers
    What HN says

    Commenters link it for integer-to-string benchmarks, file buffering tips, the std::format proposal, and his post on giving up on Julia.

    Stats for nerds
    20HN people shared it
    30linked in comments
    946story points
    Dec 2023last shared
    2016people per year2023

    Top posts on HN

    1. 1
      Giving up on Julia
      6 people · 457 points · first shared 2016 · 230 comments on HN
    2. 2
      ReStructuredText vs. Markdown for documentation
      2 people · 197 points · first shared 2016 · 117 comments on HN
    3. 3
      Formatting floating point numbers
      2 people · 173 points · first shared 2019 · 130 comments on HN
    4. 4
      A quest for safe text formatting API
      2 people · 41 points · first shared 2021 · 9 comments on HN
    5. 5
      Reducing printf call overhead with variadic templates
      2 people · 24 points · first shared 2016 · 2 comments on HN
    6. 6
      std::format in C++20
      6 people · 13 points · first shared 2019 · Discussion on HN
    7. 7
      Reducing {fmt} library size 4x using Bloaty McBloatface
      2 people · 9 points · first shared 2020 · Discussion on HN
    8. 8
      Improving compile times of C++ code
      4 people · 5 points · first shared 2017 · Discussion on HN
    9. 9
      iOS SSID format string bug is preventable
      2 people · 4 points · first shared 2021 · Discussion on HN
    10. 10
      Comparison of C++ Format and C library’s printf
      1 person · 4 points · first shared 2015 · Discussion on HN

    What HN people wrote when they linked it

    • jb1991Jun 2018

      Honest question, just how fast is Julia anyway? Because performance is typically the main reason anyone would want to use it over alternatives. A lot of people justify Julia because, as noted in other comments, it is both high-level yet claims to be nearly as fast as C:

      > "Julia is the fastest modern open-source language for data science, machine learning and scientific computing...with the speed, capacity and performance of C, C++..." [4]

      That's a bold claim! And there is much evidence to the contrary. I often find that the language falls into a similar trap of many other languages where the creators are evangelists not quite sharing the whole picture. Writing fast Julia code is not always a pleasant experience as you often need to fight the easier idioms. It is marketed as fast, but really, how fast is it?

      [0] http://www.zverovich.net/2016/05/13/giving-up-on-julia.html

      "What’s disappointing is the striking difference between the claimed performance and the observed one. For example, a trivial hello world program in Julia runs ~27x slower than Python’s version and ~187x slower than the one in C."

      [1] https://www.ibm.com/developerworks/community/blogs/jfp/entry/A_Comparison_Of_C_Julia_Python_Numba_Cython_Scipy_and_BLAS_on_LU_Factorization?lang=en

      "We can code in Julia in a way similar to Python's code. However, that code is slower than it should. One way to speed Julia is to take into account the Fortran ordering it uses by looping on j before looping on i in the…

    • pjc50Nov 2022

      > Int to string is especially egregious because it requires a lot of division which is basically the slowest (common) thing you can do on a CPU.

      Yeah. There's some great benchmarking and tips: https://www.zverovich.net/2013/09/07/integer-to-string-conversion-in-cplusplus.html

      Godbolt example: https://godbolt.org/z/M4b353PKv of which the meat is

      imul rcx, rcx, 1374389535
      shr rcx, 37
      imul edi, ecx, 100
      mov r8d, edx
      sub r8d, edi
      movzx edi, WORD PTR .LC2[r8+r8]
      mov WORD PTR [rsi], di

      So if our example input is 12345, the first two instructions use the field-inverse property to compute "123" with multiply rather than divide (1 clock, latency 4), then multiply up again to get "12300", then subtract that to get "45". That can then be looked up at position 45+45 in the string "00010203040506070809101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899" to give you the two digits.

    • coder543Oct 2020

      CircleCI offers build caching that works well enough, for example. It's not the super advanced stuff that Bazel can do, but you don't need Bazel to do build caching.

      When the Linux kernel (~27 million LoC) can be compiled from scratch in under a minute on modern machines (30 seconds on some of the beefier machines)... there's clearly a lot of low-hanging fruit in that "hours long" compilation that has nothing to do with build caching.

      Whether you can get stakeholders to buy into paying down technical debt or not is an unrelated discussion. Sometimes it's easier to sell fancier build systems as the solution instead of better code organization and simplifying overly generic code.

      C++ code doesn't have to be super slow to compile: https://www.zverovich.net/2017/12/09/improving-compile-times.html

    • vitautDec 2023

      {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: https://www.zverovich.net/2020/08/04/optimal-file-buffer-size.html.

    • signa11Aug 2020

      > Which raises the obvious questions: why didn't C++11 implement template printf along with variadic templates?

      https://en.cppreference.com/w/cpp/utility/format and the actual proposal https://www.zverovich.net/2019/07/23/std-format-cpp20.html

    • MegaDeKayMay 2016

      The link to that article is below. printf in C tranlates to a few lines of assembly in preparation for a call to sprintf. That in turn will have a lot more instructions in assembler.

      http://zverovich.net/2016/05/13/giving-up-on-julia.html

    Related

    Howard Hinnanthowardhinnant.github.io17 people

    C++ Coding Guidelines (2014)

    Howard Hinnant
    Personal · last shared 2025
    C++ Truthscpptruths.blogspot.com17 people

    Covariance and Contravariance in C++ Standard Library

    C++ Truths
    Personal · last shared 2019
    C++ Storiescppstories.com35 people

    Embracing Modern C++ Safely, Book Review

    C++ Stories
    Personal · last shared 2026
    Aras Pranckevičiusaras-p.info79 people

    I accidentally Blender VSE

    Aras Pranckevičius
    Personal · last shared 2026
    John Regehrblog.regehr.org401 people

    Teaching C

    John Regehr
    Personal · last shared 2026
    matkladmatklad.github.io237 people

    Architecture.md

    matklad
    Personal · last shared 2026
    Martin Sústrik250bpm.com126 people

    Why should I have written ZeroMQ in C, not C++

    Martin Sústrik
    Personal · last shared 2026
    Herb Sutterherbsutter.com204 people

    Bjarne Stroustrup on Dennis Ritchie: They said it couldn't be done, & he did it

    Herb Sutter
    Personal · last shared 2026