2642
Comment: mention read speed
|
15
FreeBSD's java doesn't give me a good read() benchmark, have to redo these
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
Some PyFile benchmarks, mostly to show off the PyFile nio rewrite Tests done on FreeBSD 6.2-RELEASE, Java 1.5.0_13 in server mode and Python 2.5.1 (If anyone's worried about FreeBSD Java, the times are in line with OS X's Java 1.5) Preparations: 100 Iterations: 5 Notes: * jython's file iter is roughly equivalent to its readline, whereas CPython's readline is not as optimized as its iter * The few anomalies in the smaller benchmarks are probably due to hotspot kicking in. Ideally we would run more preparations * why is read slower than iter? seems like a lot of time is spent in allocating the ByteBuffer whereas iter uses a pre-allocated, small one. Reading: {{{#!python def test_read(self, fp): fp.read() test_read = bench(test_read) }}} [http://underboss.org/~pjenvey/jython/pyfile-nio/small/test_read.jpg] [http://underboss.org/~pjenvey/jython/pyfile-nio/big/test_read.jpg] {{{#!python def test_iter(self, fp): for line in fp: pass }}} [http://underboss.org/~pjenvey/jython/pyfile-nio/small/test_iter.jpg] [http://underboss.org/~pjenvey/jython/pyfile-nio/big/test_iter.jpg] {{{#!python def test_readline(self, fp): while fp.readline(): pass }}} [http://underboss.org/~pjenvey/jython/pyfile-nio/small/test_readline.jpg] [http://underboss.org/~pjenvey/jython/pyfile-nio/big/test_readline.jpg] {{{#!python def test_readline_with_tell(self, fp): while fp.readline(): fp.tell() }}} [http://underboss.org/~pjenvey/jython/pyfile-nio/small/test_readline_with_tell.jpg] [http://underboss.org/~pjenvey/jython/pyfile-nio/big/test_readline_with_tell.jpg] {{{#!python def test_readlines(self, fp): fp.readlines() }}} [http://underboss.org/~pjenvey/jython/pyfile-nio/small/test_readlines.jpg] [http://underboss.org/~pjenvey/jython/pyfile-nio/big/test_readlines.jpg] Writing: {{{#!python MSG = ('abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz123456789' '0abcdefgh\r\n') }}} {{{#!python def test_write(self, fp, lines): write = fp.write for i in range(lines): write(MSG) }}} [http://underboss.org/~pjenvey/jython/pyfile-nio/small/test_write.jpg] [http://underboss.org/~pjenvey/jython/pyfile-nio/big/test_write.jpg] {{{#!python def test_writelines(self, fp, lines): lines = [MSG for i in range(lines)] fp.writelines(lines) }}} [http://underboss.org/~pjenvey/jython/pyfile-nio/small/test_writelines.jpg] [http://underboss.org/~pjenvey/jython/pyfile-nio/big/test_writelines.jpg] |
Coming soon.. |
Coming soon..