3 ms·
Similar here, reading the file from stdin on a 2020 MBP on macOS 11.2.2 is incredibly slow. int main() { std::ios::sync_with_stdio(false);
by w-m 6y ago
Similar here, reading the file from stdin on a 2020 MBP on macOS 11.2.2 is incredibly slow.
int main() {
std::ios::sync_with_stdio(false);
std::string str((std::istreambuf_iterator<char>(std::cin)),
std::istreambuf_iterator<char>());
}
takes around 8 seconds to run, no counting at all.
int main() {
std::ifstream f("kjvbible_x10.txt");
std::string str((std::istreambuf_iterator<char>(f)),
std::istreambuf_iterator<char>());
}
runs in ~270 miliseconds. Factor 30x, yikes.