aboutsummaryrefslogtreecommitdiff
path: root/pypy/doc
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2020-06-29 19:17:16 +0200
committerArmin Rigo <arigo@tunes.org>2020-06-29 19:17:16 +0200
commit3c2b8674133a320696d935386f391cb0861272e5 (patch)
treed342d9bf47ba01bf19ea57ae4e04636139b83bb6 /pypy/doc
parent#3251 (diff)
downloadpypy-3c2b8674133a320696d935386f391cb0861272e5.tar.gz
pypy-3c2b8674133a320696d935386f391cb0861272e5.tar.bz2
pypy-3c2b8674133a320696d935386f391cb0861272e5.zip
A FAQ entry "I wrote a 3-lines benchmark and it's not faster than CPython.
Why?"
Diffstat (limited to 'pypy/doc')
-rw-r--r--pypy/doc/faq.rst16
1 files changed, 16 insertions, 0 deletions
diff --git a/pypy/doc/faq.rst b/pypy/doc/faq.rst
index bbc981dd3b..7f78c1c2bb 100644
--- a/pypy/doc/faq.rst
+++ b/pypy/doc/faq.rst
@@ -278,6 +278,22 @@ complicated programs need even more time to warm-up the JIT.
.. _your tests are not a benchmark: http://alexgaynor.net/2013/jul/15/your-tests-are-not-benchmark/
+I wrote a 3-lines benchmark and it's not faster than CPython. Why?
+-------------------------------------------------------------------
+
+Three-lines benchmarks are benchmarks that either do absolutely nothing (in
+which case PyPy is probably a lot faster than CPython), or more likely, they
+are benchmarks that spend most of their time doing things in C.
+
+For example, a loop that repeatedly issues one complex SQL operation will only
+measure how performant the SQL database is. Similarly, computing many elements
+from the Fibonacci series builds very large integers, so it only measures how
+performant the long integer library is. This library is written in C for
+CPython, and in RPython for PyPy, but that boils down to the same thing.
+
+PyPy speeds up the code written *in Python*.
+
+
Couldn't the JIT dump and reload already-compiled machine code?
---------------------------------------------------------------