10倍速い

ひどい話だ。

import java.io.*;

class hoge{
  public static void main(String[] argv){
    long[] t = new long[100];

    {
      t[0] = System.nanoTime();
      for(int i=0; i<1000000; ++i){
        System.out.print("a ");
      }
      t[0] = System.nanoTime() - t[0];
    }
    {
      t[1] = System.nanoTime();
      PrintWriter out = new PrintWriter(System.out);
      for(int i=0; i<1000000; ++i){
        out.print("a ");
      }
      out.flush();
      t[1] = System.nanoTime() - t[1];
    }

    for(int i=0; t[i] != 0; ++i){
      System.err.println(t[i]);
    }
  }
}
$ java hoge > /dev/null
1404164000
124211000