During the project, many logs are printed on the console for debugging convenience. Each time you perform an operation, many logs are output, causing the program to look very slow. Is it so slow to print information to the console? I suddenly thought that Linux was not so slow, so I did a simple test. The test procedure is very simple. It is to use System. out. println () to write a string to the console and write it 100,000 times. I tested 10 in my windowsxp and Ubuntu8.04 respectively.
During the project, many logs are printed on the console for debugging convenience. Each time you perform an operation, many logs are output, causing the program to look very slow. Is it so slow to print information to the console? I suddenly thought that Linux was not so slow, so I did a simple test. The test procedure is very simple. It is to use System. out. println () to write a string to the console and write it 100,000 times. I tested it 10 times in my windows xp and Ubuntu 8.04 respectively, and found that it took an average of 9.8 seconds in Linux, and 18.6 seconds in windows, which is almost twice that of Linux. Sun's 1.6 virtual machines were used on both sides, but we did not expect such a big difference.
Is java faster on Linux than on windows? I want to find some more comprehensive and authoritative tests, but I cannot find them. On sun's official forum, some people said that the performance on the two systems was similar, and they did not know where he got the conclusion. Through this simple test, we can at least see that on the x86 platform, the same as the sun 1.6 virtual machine, when writing to the console, on windows xp, it is twice slower than Ubuntu 8.04.