Have jsonfindptrs not flush stdout after each line

On a mid-range x86_64 laptop, processing the 181 MiB citylots.json file
from github.com/zemirco/sf-city-lots-json:

$ time gen/bin/example-jsonfindptrs < citylots.json > /dev/null
Before this commit:
real	0m21.104s
After:
real	0m9.774s
Ratio: 2.16x
This commit is contained in:
Nigel Tao committed 2020-08-29 10:33:41 +10:00
1 parent 65b0b59529
commit feded888dd
1 file changed
+2 -2
+2 -2
View File
@@ -350,7 +350,7 @@ escape_needed:
std::string //
print_json_pointers(JsonThing& jt, std::string s, uint32_t depth) {
std::cout << s << std::endl;
std::cout << s << '\n';
if (depth++ >= g_flags.max_output_depth) {
return "";
}
@@ -534,7 +534,7 @@ compute_exit_code(std::string status_msg) {
if (status_msg.empty()) {
return 0;
}
std::cerr << status_msg << std::endl;
std::cerr << status_msg << '\n';
// Return an exit code of 1 for regular (forseen) errors, e.g. badly
// formatted or unsupported input.
//