[logback-user] log4j performance comparison

hostalp at post.cz hostalp at post.cz
Sun Mar 20 17:31:31 CET 2011

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).

More information about the Logback-user mailing list