Don't sync with C library I/O buffers
authorMarco Costalba <mcostalba@gmail.com>
Mon, 12 Mar 2012 14:21:54 +0000 (15:21 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Mon, 12 Mar 2012 18:34:19 +0000 (19:34 +0100)
Now we are forced to just use C++ iostream becuase
buffers are independent and using C library functions
like printf() or scanf() could yield to issues.

Speed up of about 1%.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/main.cpp

index 0c94ed892bfc669b6bcf1727c78910b3698a9bd7..1b2fdf9dec5efff93d657b46ff042b31ef516254 100644 (file)
@@ -43,6 +43,11 @@ int main(int argc, char* argv[]) {
   Eval::init();
   TT.set_size(Options["Hash"]);
 
+  // Don't sync with C library I/O buffers, faster but now using printf()
+  // or scanf() could yield to issues because buffers are independent.
+  cout.sync_with_stdio(false);
+  cin.sync_with_stdio(false);
+
   cout << engine_info() << endl;
 
   if (argc == 1)