Windows console is SLOW
If you don’t know this already, here’s a hint: don’t use standard windows console to print large amounts of data if you care about performance. It’s dead slow.
Recently while writing custom data exporter for a certain business application I noticed strange slowdowns. The application server runs on JBoss as a servlet and I’m communicating with it via web service interface from a C# app. One day I logged on the server machine via remote desktop while my data crawler was running and noticed that the JBoss console was furiously printing heaps of log messages. As it turned out every single HTTP request was printed on the console in detail as INFO message. JBoss uses log4j so I could filter INFO messages out, but the application server also uses INFO for some other diagnostic stuff I’d like to keep. HTTP requests are certainly debug-level data, but apparently creators of the app didn’t think that way. So what did I do? Minimized the JBoss console. Instant speed up of ~20%.
code, rant
I’m not sure if you’re going somewhere with the ‘windows-only’, because it’s well know that consoles output are slow, whether on windows or linux or os x.
As an interesting side note, if you’re working with C++ and you have to print or read a lot to or from the console, use the ‘old’ C iostd commands printf and scanf instead of the iostreams cout and cin. It will increase your speed dramatically!
Well, standard Windows’ console implementation is really slow, you can do an order of magnitude better with your own implementation, even using just GDI. In fact my friend wrote such thing some time ago: http://sourceforge.net/projects/fastlogconsole/