300 iterations, no user interaction:
Code: Select all
Running normally: 17s
Running without calling cmdgfx.exe: 0s
Running with cmdgfx.exe, compiled to return immediately: 1s
Running with cmdgfx.exe, not calling the Windows function WriteConsoleOutput: 8s
How slow is WriteConsoleOutput!!?
It's one single call, and all it has to do is take the 180x110 character text buffer and show it. This takes 53% of the total time.
Much more than the 41% it takes to read an obj file, parse it, read 3 texture bitmaps, rotate 1016 points in 3d, draw (up to) 762 polygons with texture maps, then read another obj file, read another bitmap, rotate 640 points, and draw (up to) 160 more polygons!
Why, Microsoft, why?
(and note that the rendering in this example is kind of heavy, for more simple stuff it's common for WriteConsoleOutput to take 75% or more of the total time...)