forked from scylladb/seastar
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge 'treewide: reduce the usage of iostream in headers' from Kefu Chai
for better compilation speed, as `<iostream>` is the one of the heaviest C++ headers. in this series: - stop using iostream in `seastar/net/packet-util.hh` - extract `seastar::format()` into `format.hh` - use `format.hh` directly tested on my laptop with 32 G memory, 8c16t. - ccache and distcc are not enabled - all interaction with the computer are stopped - most of the active foreground tasks showed by `top` are stopped before this change: --- ```console $ git clean -dfx $ ./configure.py --mode debug --disable-dpdk --compiler clang++ $ time cmake --build build/debug ... real 2m43.926s user 35m58.795s sys 1m50.180s ``` after this change: --- ```console $ git clean -dfx $ ./configure.py --mode debug --disable-dpdk --compiler clang++ $ time cmake --build build/debug ... real 2m42.688s user 35m55.328s sys 1m50.926s ``` i repeated the test for 3 times. the change shortened the build time 3 out of 3 times. Closes scylladb#2526 * https://github.com/scylladb/seastar: treewide: include core/format.hh when appropriate print: remove unused fmt/ostream.h print: extract format() into format.hh net: route error messages to logger instead of to stderr net: stop printing when reaching unreachable branch
- Loading branch information
Showing
12 changed files
with
65 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* This file is open source software, licensed to you under the terms | ||
* of the Apache License, Version 2.0 (the "License"). See the NOTICE file | ||
* distributed with this work for additional information regarding copyright | ||
* ownership. You may not use this file except in compliance with the License. | ||
* | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
/* | ||
* Copyright (C) 2014 Cloudius Systems, Ltd. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <seastar/core/sstring.hh> | ||
#ifndef SEASTAR_MODULE | ||
#include <fmt/format.h> | ||
#endif | ||
|
||
namespace seastar { | ||
|
||
/** | ||
* Evaluate the formatted string in a native fmt library format | ||
* | ||
* @param fmt format string with the native fmt library syntax | ||
* @param a positional parameters | ||
* | ||
* @return sstring object with the result of applying the given positional | ||
* parameters on a given format string. | ||
*/ | ||
template <typename... A> | ||
sstring | ||
format(fmt::format_string<A...> fmt, A&&... a) { | ||
fmt::memory_buffer out; | ||
fmt::format_to(fmt::appender(out), fmt, std::forward<A>(a)...); | ||
return sstring{out.data(), out.size()}; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters