4 ms·
Adding a few results: Using OP's code for following php 1.8mb/sec python 3.8 Mb/sec node 1.0 Mb/sec Java print 1.3 Mb/sec echo 'class Code {
by rhyn00 4y ago
Adding a few results:
Using OP's code for following
php 1.8mb/sec
python 3.8 Mb/sec
node 1.0 Mb/sec
Java print 1.3 Mb/sec
echo 'class Code {public static void main(String[] args) {while (true){System.out.print("1");}}}' >Code.java; javac Code.java ; java Code | pv>/dev/null
Java with buffering 57.4 Mb/sec
echo 'import java.io.*;class Code2 {public static void main(String[] args) throws IOException {BufferedWriter log = new BufferedWriter(new OutputStreamWriter(System.out));while(true){log.write("1");}}}' > Code2.java ; javac Code2.java ; java Code2 | pv >/dev/null
- kuschku 4y agoJava can get even much much faster: https://gist.github.com/justjanne/12306b797f4faa977436070ec0bd865f https://gist.github.com/justjanne/12306b797f4faa977436070ec0... That manages about 7 GiB/s reusing the same buffer, or about 300 MiB/s with clearing and refilling the buffer every time (the magic is in using java’s APIs for writing to files/sockets, which are designed for high performance, instead of using the APIs which are designed for writing to stdout)
- rhyn00 4y agoNice, that's pretty cool!