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
@@ -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.
//
