-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#include <fmt/format.h>
is expensive on Debian Testing
#1998
Comments
The cost comes from the common standard library includes that are likely to be transitively included anyway pretty much in every translation unit in a nontrivial C++ project. You can further improve compile times using precompiled headers. That said I moved two includes, With this change ~90% of the compile time for ( Also 20 ms for
or 337 ms on clang/macOS/libc++ (and this is one of the faster runs =)). I guess it could depend on the standard library implementation but I would be surprised to see a 15x difference. There is probably something wrong with measurement. |
Yes, it looks like my iostream number was off by an order of magnitude, I see ~ However when I compile code with I was under the impression that I need
I'm willing to believe that this is user error, but it is 100% repeatable on debian. |
You need |
Unfortunately Debian only provides versions 5.x and 6.x at the moment: https://packages.debian.org/search?keywords=libfmt-dev but it's easy to install a newer one from source or embed it in your project. |
I'm using trunk. You should try your test with |
Is there a forward declaration of format in core.h? |
Oh, you mean that it's expected that I don't know why the compile time goes through the roof for Thanks for looking at this. |
Sort of. 1.3s is still surprisingly slow but On macOS/clang I see that
I'll check what's happening on Debian testing, thanks for reporting. |
#include <fmt/format.h>
is expensive#include <fmt/format.h>
is expensive on Debian Testing
Ouch. It's possible that In the meantime I'll try and figure out what the declaration of |
Kicked one more header out of |
Removed the |
I'd like to provide format capabilities to my objects, however
#include <fmt/format.h>
adds .2s - .25s time to every translation unit that includes the resulting header. This doesn't depend on any use offmt::
, it's just the include.This might not seem like a lot, but can add up to meaningful times in larger projects. This seems like quite a large opportunity-cost just to provide the capability.
As a comparison,
#include <iostream>
adds a difficult-to-measure 0.02s, and#include <ranges>
isn't adding any measurable time on my debian-testing platform.The text was updated successfully, but these errors were encountered: