remove some str copies
MODIFY
tv/tv.cpp
tv/tv.cpp
@@ -84,14 +84,14 @@ void sigalarm_handler(int) {
_Exit(0);
}
-static void printDot(const Function &tgt, int n) {
+void printDot(const Function &tgt, int n) {
if (opt_print_dot) {
string prefix = to_string(n);
tgt.writeDot(prefix.c_str());
}
}
-static string toString(const Function &fn) {
+string toString(const Function &fn) {
stringstream ss;
fn.print(ss);
return ss.str();

MODIFY
util/parallel.cpp
util/parallel.cpp
@@ -182,7 +182,7 @@ void parallel::finishChild(bool is_timeout) {
safe_write(fd_to_parent, msg, strlen(msg));
} else {
childProcess &me = children.back();
- auto data = me.output.str();
+ auto data = move(me.output).str();
auto size = data.size();
ENSURE(safe_write(me.pipe[1], data.c_str(), size) == (ssize_t)size);
}
@@ -212,7 +212,7 @@ bool parallel::emitOutput() {
assert(sm.size() == 2);
int index = std::stoi(*std::next(sm.begin()));
if (children[index].eof) {
- out_file << children[index].output.str();
+ out_file << move(children[index].output).str();
stringstream().swap(children[index].output); // free the RAM
} else {
/*

remove some str copies