minor changes (indentation fixed)

This commit is contained in:
tommy3001
2014-02-15 18:38:43 +01:00
parent a30b491b56
commit 7ef55e755f
+5 -3
View File
@@ -149,7 +149,8 @@ And what is with the speed? So lets try it!
import time import time
#activate pyx compiler #activate pyx compiler
import pyximport; pyximport.install() import pyximport
pyximport.install()
#primes implemented with Cython #primes implemented with Cython
import primesCy import primesCy
#primes implemented with Python #primes implemented with Python
@@ -172,14 +173,15 @@ Where is the magic? Here it is:
.. code-block:: python .. code-block:: python
import pyximport; pyximport.install() import pyximport
pyximport.install()
With the module `pyximport` you are able to import Cython `*.pyx` files, in this case `primesCy.pyx`, with the Cython With the module `pyximport` you are able to import Cython `*.pyx` files, in this case `primesCy.pyx`, with the Cython
version of the primes function. version of the primes function.
The `pyximport.install()` command allows the Python interpreter to start the Cython compiler directly to generate C-code, The `pyximport.install()` command allows the Python interpreter to start the Cython compiler directly to generate C-code,
which is automatically compiled to a `*.so` C-library. ... and Cython is able to import this library for you in your Python-code. which is automatically compiled to a `*.so` C-library. ... and Cython is able to import this library for you in your Python-code.
Very easy and very efficient. With the `time.time()` function you are able to compare the time between this 2 different calls to find 500 (!) prime numbers. Very easy and very efficient. With the `time.time()` function you are able to compare the time between this 2 different calls to find 500 prime numbers.
Here is the output of an embedded `ARM beaglebone <http://beagleboard.org/Products/BeagleBone>`_ machine: Here is the output of an embedded `ARM beaglebone <http://beagleboard.org/Products/BeagleBone>`_ machine: