sapling/eden/fs/service
Victor Zverovich f3feef687f Deprecate folly::format
Summary:
`folly::format` is a problematic API because it returns a `Formatter` object that may store references to arguments as its comment warns:

```
 * Formatter class.
 *
 * Note that this class is tricky, as it keeps *references* to its lvalue
 * arguments (while it takes ownership of the temporaries), and it doesn't
 * copy the passed-in format string. Thankfully, you can't use this
 * directly, you have to use format(...) below.
```

This has negative safety and performance (encourages reuse of the same formatter) implications because contrary to what the comment says you can use the object directly since it's returned from `folly::format`. For example
```
auto f = folly::format(std::string("{}"), 42);
f.str();
```
is a UB with no compile-time diagnostic (only caught by ASAN).

It's also unnecessary because the `Formatter` object is usually converted to string straight away via `str()` or written to an output stream. Reusing the formatter doesn't make much sense either because the expensive part is formatting, not capturing arguments.

This diff deprecates `folly::format` suggesting `fmt::format` as a potential replacement. `fmt::format` doesn't have the above problem because arguments are always in scope. It also has the following advantages:

* Better compile times.
* Compile-time format string checks.
* Compatibility with C++20 `std::format`.
* Better performance, particularly with format string compilation which eliminates format string processing overhead altogether.
* Smaller binary footprint.

Also remove `folly::writeTo` which is no longer used and the `format_nested_fbstrings` benchmark which is identical to `format_nested_strings` since there is no `fbstr()` any more.

Reviewed By: yfeldblum

Differential Revision: D26391489

fbshipit-source-id: f0309e78db0eb6d8c22b426d4cc333a17c53f73e
2021-02-27 07:02:55 -08:00
..
oss service: unify startup on Windows/Linux/macOS 2020-10-22 16:24:17 -07:00
test Rename Try::throwIfFailed -> throwUnlessValue 2021-01-11 13:05:17 -08:00
.gitignore watchman: pull in thrift in the oss build for eden support 2019-02-04 21:37:47 -08:00
CMakeLists.txt move EdenError to utils/ 2021-02-23 19:58:03 -08:00
eden.thrift add eden glob command 2021-02-23 19:58:03 -08:00
EdenCPUThreadPool.cpp Tidy up license headers 2019-10-11 05:28:23 -07:00
EdenCPUThreadPool.h Tidy up license headers 2019-10-11 05:28:23 -07:00
EdenInit.cpp eden: use fmt::format instead of folly::to 2020-09-23 21:14:20 -07:00
EdenInit.h eden: use fmt::format instead of folly::to 2020-09-23 21:14:20 -07:00
EdenMain.cpp fix spurious fbwhoami crashes on corp 2021-01-26 13:20:09 -08:00
EdenMain.h fix spurious fbwhoami crashes on corp 2021-01-26 13:20:09 -08:00
EdenServer.cpp Deprecate folly::format 2021-02-27 07:02:55 -08:00
EdenServer.h telemetry: switch to using quantile stats instead of timeseries 2021-02-14 16:37:08 -08:00
EdenServiceHandler.cpp Deprecate folly::format 2021-02-27 07:02:55 -08:00
EdenServiceHandler.h remove the unused glob() implementation 2020-12-01 13:39:14 -08:00
EdenStateDir.cpp fix issues when checking EdenFS status on windows 2020-04-15 15:46:24 -07:00
EdenStateDir.h exit if the EdenFS lock file ever becomes invalid 2020-03-26 20:17:12 -07:00
fb-edenfs@.service set OOMScoreAdjust to -20 in systemd unit 2019-10-02 12:53:28 -07:00
PeriodicTask.cpp Tidy up license headers 2019-10-11 05:28:23 -07:00
PeriodicTask.h Tidy up license headers 2019-10-11 05:28:23 -07:00
PrettyPrinters.cpp Migrate to field_ref Thrift API 2020-07-21 11:23:35 -07:00
PrettyPrinters.h Tidy up license headers 2019-10-11 05:28:23 -07:00
PrivHelperMain.cpp edenfs: remove use of fork from StartupLogger 2020-09-18 17:22:39 -07:00
StartupLogger.cpp Apply clang-format update fixes 2021-01-10 10:06:29 -08:00
StartupLogger.h service: unify startup on Windows/Linux/macOS 2020-10-22 16:24:17 -07:00
streamingeden.thrift log returned inode numbers from lookup/create/mkdir 2021-02-23 12:27:10 -08:00
Systemd.cpp Tidy up license headers 2019-10-11 05:28:23 -07:00
Systemd.h Tidy up license headers 2019-10-11 05:28:23 -07:00
ThriftPermissionChecker.cpp Tidy up license headers 2019-10-11 05:28:23 -07:00
ThriftPermissionChecker.h Tidy up license headers 2019-10-11 05:28:23 -07:00
ThriftUtil.h move EdenError to utils/ 2021-02-23 19:58:03 -08:00