4 ms·
C# beats Java in 9 out of 10 benchmarks (benchmarks game)
- sorokod 8y agoNot sure what the output of Java Mandelbrot supposed to produce - it really does a number on the terminal. Anyway, the original version spends half of it's time writing to stdout, verify by replacing OutputStream stream = new BufferedOutputStream(System.out); with OutputStream stream = new BufferedOutputStream(new FileOutputStream("./mandel_out")); The time can be cut in half again by not using AtomicInteger (it is heavily contended) and having every thread operate on it's own chunk of the out array without any synchronization.
- superjan 8y agoFeel free to submit your suggestion: https://salsa.debian.org/benchmarksgame-team/benchmarksgame/blob/master/CONTRIBUTING.md https://salsa.debian.org/benchmarksgame-team/benchmarksgame/...
- igouy 8y ago> writing to stdout rtm "with output redirected to /dev/null" ! https://benchmarksgame-team.pages.debian.net/benchmarksgame/how-programs-are-measured.html#measured https://benchmarksgame-team.pages.debian.net/benchmarksgame/... > new BufferedOutputStream(System.out); $ time /opt/src/jdk-10.0.1/bin/java mandelbrot 16000 > /dev/null real 0m7.144s user 0m27.405s sys 0m0.156s > new FileOutputStream("./mandel_out") $ time /opt/src/jdk-10.0.1/bin/java mandelbrot 16000 real 0m7.125s user 0m27.367s sys 0m0.184s
- sorokod 8y agoYup - writing to disk it pretty fast. Not sure what your point is though as according to https://benchmarksgame-team.pages.debian.net/benchmarksgame/program/mandelbrot-java-2.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/... the output for the benchmark is not redirected to /dev/null : COMMAND LINE: /opt/src/jdk-10.0.1/bin/java mandelbrot 16000
- igouy 8y agortm "2. If the program gives the expected output within an arbitrary cutoff time (120 seconds) the program is measured again (5 more times) with output redirected to /dev/null."
- igouy 8y agortm "1. Each program is run and measured at the smallest input value, program output redirected to a file and compared to expected output. As long as the output matches expected output, the program is then run and measured at the next larger input value until measurements have been made at every input value."
- igouy 8y ago> …it really does a number on the terminal The measurements are not made by typing each program command line into a terminal window. rtm "Each program is run as a child-process of a Python script using Popen…" https://benchmarksgame-team.pages.debian.net/benchmarksgame/how-programs-are-measured.html#time https://benchmarksgame-team.pages.debian.net/benchmarksgame/...