The main takeaway for me is that the default should be to do buffered I/O. Unfortunately, I didn't see an option in Logback to enable buffering at all, much less make it the default. I'm doing that in Log4j2. Doing that cut my overall elapsed time in half.
Ralph On Mar 20, 2011, at 9:31 AM, [email protected] wrote: > Yeah, also interesting stuff. > And more just for the curiosity - I tried to wrap the FileWriter by > BufferedWriter ( > http://download.oracle.com/javase/6/docs/api/java/io/BufferedWriter.html ) in > your test and to no surprise the result also became very close to > BufferedOutputStream. > > Following results are from 2nd runs within the JVM instance as first runs are > (as usually) a little more "biased": > > Java 6: > FileOutputStream: 7186 > BufferedOutputStream: 613 > FileWriter: 713 > BufferedWriter/FileWriter: 625 > > Java 1.5: > FileOutputStream: 7765 > BufferedOutputStream: 955 > FileWriter: 1131 > BufferedWriter/FileWriter: 918 > > Looks like the use of FileWriter itself is a decent option while adding > buffering always helps at least a little. > Also funny that BufferedWriter around FileWriter performs consistently better > than BufferedOutputStream at Java 1.5 while at Java 6 it's exactly the > opposite (but here the difference is minor). > _______________________________________________ > Logback-user mailing list > [email protected] > http://qos.ch/mailman/listinfo/logback-user _______________________________________________ Logback-user mailing list [email protected] http://qos.ch/mailman/listinfo/logback-user
