[pypy-commit] extradoc extradoc: work on the blog post
fijal
noreply at buildbot.pypy.org
Wed Nov 5 15:54:15 CET 2014
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: extradoc
Changeset: r5455:63fbacecbb24
Date: 2014-11-05 16:54 +0200
http://bitbucket.org/pypy/extradoc/changeset/63fbacecbb24/
Log: work on the blog post
diff --git a/blog/draft/io-improvements.rst b/blog/draft/io-improvements.rst
--- a/blog/draft/io-improvements.rst
+++ b/blog/draft/io-improvements.rst
@@ -5,6 +5,9 @@
branches which have been recently merged and which improved the I/O and the
GC: `gc_no_cleanup_nursery`_ and `gc-incminimark-pinning`_.
+.. _`gc_no_cleanup_nursery`: https://bitbucket.org/pypy/pypy/commits/9e2f7a37c1e2
+.. _`gc-incminimark-pinning`: https://bitbucket.org/pypy/pypy/commits/64017d818038
+
The first branch was started by Wenzhu Man for her Google Summer of Code
and finished by Maciej Fijałkowski and Armin Rigo.
The PyPy GC works by allocating new objects in the young object
@@ -21,10 +24,21 @@
a recursive implementation of `fibonacci`_ and `gcbench`_,
to measure GC performance.
+.. _`fibonacci`: https://bitbucket.org/pypy/benchmarks/src/69152c2aee7766051aab15735b0b82a46b82b802/own/fib.py?at=default
+.. _`gcbench`: https://bitbucket.org/pypy/benchmarks/src/69152c2aee7766051aab15735b0b82a46b82b802/own/gcbench.py?at=default
+
The results for fibonacci and gcbench are below (normalized to cpython
-2.7). Benchmarks were run 50 times each:
+2.7). Benchmarks were run 50 times each (note that the big standard
+deviation comes mostly from the warmup at the beginning, true figures
+are smaller):
-XXXX
++----------------+----- ------------+-------------------------+--------------------+
+| benchmark | CPython | PyPy 2.4 | PyPy non-zero |
++----------------+------------------+-------------------------+--------------------+
+| fibonacci | 4.8+-0.15 (1.0x) | 0.59+-0.07 (8.1x) | 0.45+-0.07 (10.6x) |
++----------------+------------------+-------------------------+--------------------+
+| gcbench | 22+-0.36 (1.0x) | 1.34+-0.28 (16.4x) | 1.02+-0.15 (21.6x) |
++----------------+------------------+-------------------------+--------------------+
The second branch was done by Gregor Wegberg for his master thesis and finished
by Maciej Fijałkowski and Armin Rigo. Because of the way it works, the PyPy GC from
@@ -51,8 +65,28 @@
non-zero-nursery and ``3d8fe96dc4d9`` for non-zero-nursery and pinning.
The benchmarks were run once, since the standard deviation was small.
-XXX explain why files are still bad and what we plan to do about it
-
XXXX
-XXX summary
+`The benchmark`_ consists of looped calls to ``os.read``, ``os.write``
+or ``file.read`` and ``file.write`` using different size strings. For writing
+the strings are freshly constructed. Consult the benchmark for details.
+
+What we can see is that ``os.read`` and ``os.write`` both improved greatly
+and outperforms CPython now for each combination. ``file`` operations are
+a little more tricky, and while those branches improved the situation a bit,
+the improvement is not as drastic as in ``os`` versions. It really should not
+be the case and it showcases how our ``file`` buffering is inferior to CPython.
+We plan on removing our own buffering and using ``FILE*`` in C in the near future,
+so we should outperform CPython on those too (since our allocations are cheaper).
+If you look carefully in the benchmark, the write function is copied three times.
+This hack is intended to avoid JIT overspecializing the assembler code, which happens
+because the buffering code was written way before the JIT was done. In fact, our buffering
+is hilariously bad, but if stars align correctly it can be JIT-compiled to something
+that's not half bad. Try removing the hack and seeing how the performance of the last
+benchmark drops :-) Again, this hack should be absolutely unnecessary once we remove
+our own buffering, stay tuned for more.
+
+Cheers,
+fijal
+
+.. _`The benchmark`: https://bitbucket.org/pypy/benchmarks/src/69152c2aee7766051aab15735b0b82a46b82b802/io/iobasic.py?at=default
More information about the pypy-commit
mailing list