<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>EuroSciPy&#39;09 (part 1/2): The Need For Speed (Logilab.org) RSS Feed</title>
    <description></description>
    <link>http://www.logilab.org/blogentry/9853</link>
<item>
<guid isPermaLink="true">http://www.logilab.org/blogentry/9853</guid>
  <title>EuroSciPy&#39;09 (part 1/2): The Need For Speed</title>
  <link>http://www.logilab.org/blogentry/9853</link>
  <description>&lt;img alt=&quot;http://www.logilab.org/image/9852?vid=download&quot; class=&quot;align-right&quot; src=&quot;http://www.logilab.org/image/9852?vid=download&quot; /&gt;
&lt;p&gt;The &lt;a class=&quot;reference&quot; href=&quot;http://www.euroscipy.org/&quot;&gt;EuroSciPy2009&lt;/a&gt; conference was held in Leipzig at the end of July and was
sponsored by Logilab and other companies. It started with three talks about speed.&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;starving-cpus&quot;&gt;
&lt;h3&gt;&lt;a&gt;Starving CPUs&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;In his keynote, Fransesc Alted talked about &lt;a class=&quot;reference&quot; href=&quot;http://www.euroscipy.org/talk/893&quot;&gt;starving CPUs&lt;/a&gt;. Thirty years back,
memory and CPU frequencies where about the same. Memory speed kept up for about
ten years with the evolution of CPU speed before falling behind. Nowadays,
memory is about a hundred times slower than the cache which is itself about
twenty times slower than the CPU. The direct consequence is that CPUs are
starving and spend many clock cycles waiting for data to process.&lt;/p&gt;
&lt;p&gt;In order to improve the performance of programs, it is now required to know
about the multiple layers of computer memory, from disk storage to CPU. The
common architecture will soon count six levels: mechanical disk, solid state
disk, ram, cache level 3, cache level 2, cache level 1.&lt;/p&gt;
&lt;p&gt;Using optimized array operations, taking striding into account, processing data
blocks of the right size and using compression to diminish the amount of data
that is transfered from one layer to the next are four techniques that go a long
way on the road to high performance. Compression algorithms like Blosc increase
throughput for they strike the right balance between being fast and providing
good compression ratios. Blosc compression will soon be available in &lt;a class=&quot;reference&quot; href=&quot;http://www.pytables.org/&quot;&gt;PyTables&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Fransesc also mentions the &lt;a class=&quot;reference&quot; href=&quot;http://code.google.com/p/numexpr/&quot;&gt;numexpr&lt;/a&gt; extension to &lt;a class=&quot;reference&quot; href=&quot;http://numpy.scipy.org/&quot;&gt;numpy&lt;/a&gt;, and its combination with
PyTables named tables.Expr, that nicely and easily accelerates the computation
of some expressions involving numpy arrays. In his list of references, Fransesc
cites Ulrich Drepper article &lt;a class=&quot;reference&quot; href=&quot;http://people.redhat.com/drepper/cpumemory.pdf&quot;&gt;What every programmer should know about memory&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;using-pypy-s-jit-for-science&quot;&gt;
&lt;h3&gt;&lt;a&gt;Using PyPy&#39;s JIT for science&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Maciej Fijalkowski started his talk with a general presentation of the &lt;a class=&quot;reference&quot; href=&quot;http://pypy.org/&quot;&gt;PyPy&lt;/a&gt;
framework. One uses PyPy to describe an interpreter in RPython, then generate
the actual interpreter code and its JIT.&lt;/p&gt;
&lt;p&gt;Since &lt;a class=&quot;reference&quot; href=&quot;http://pypy.org/&quot;&gt;PyPy&lt;/a&gt; is has become more of a framework to write interpreters than a
reimplementation of Python in Python, I suggested to change its misleading name to
something like &lt;cite&gt;gcgc the Generic Compiler for Generating Compilers&lt;/cite&gt;. Maciej
answered that there are discussions on the mailing list to split the project in
two and make the implementation of the Python interpreter distinct from the GcGc
framework.&lt;/p&gt;
&lt;p&gt;Maciej then focused his &lt;a class=&quot;reference&quot; href=&quot;http://www.euroscipy.org/talk/894&quot;&gt;talk&lt;/a&gt; on his recent effort to rewrite in RPython the part
of &lt;a class=&quot;reference&quot; href=&quot;http://numpy.scipy.org/&quot;&gt;numpy&lt;/a&gt; that exposes the underlying C library to Python. He says the benefits
of using PyPy&#39;s JIT to speedup that wrapping layer are already visible. He has
&lt;a class=&quot;reference&quot; href=&quot;http://morepypy.blogspot.com/2009/07/pypy-numeric-experiments.html&quot;&gt;details&lt;/a&gt; on the PyPy blog. Gaël Varoquaux added that David Cournapeau has
started working on making the C/Python split in numpy cleaner, which would
further ease the job of rewriting it in RPython.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;crosstwine-linker&quot;&gt;
&lt;h3&gt;&lt;a&gt;CrossTwine Linker&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Damien Diederen talked about his &lt;a class=&quot;reference&quot; href=&quot;http://www.euroscipy.org/talk/895&quot;&gt;work&lt;/a&gt; on &lt;a class=&quot;reference&quot; href=&quot;http://crosstwine.com/linker/&quot;&gt;CrossTwine Linker&lt;/a&gt; and compared it
with the many projects that are actively attacking the problem of speed that
dynamic and interpreted languages have been dragging along for years. &lt;a class=&quot;reference&quot; href=&quot;http://www.parrot.org/&quot;&gt;Parrot&lt;/a&gt;
tries to be the über virtual machine. &lt;a class=&quot;reference&quot; href=&quot;http://psyco.sourceforge.net/&quot;&gt;Psyco&lt;/a&gt; offers very nice acceleration, but
currently only on 32bits system. &lt;a class=&quot;reference&quot; href=&quot;http://pypy.org/&quot;&gt;PyPy&lt;/a&gt; might be what he calls the Right
Approach, but still needs a lot of work. Jython and IronPython modify the
language a bit but benefit from the qualities of the &lt;a class=&quot;reference&quot; href=&quot;http://en.wikipedia.org/wiki/JVM&quot;&gt;JVM&lt;/a&gt; or the &lt;a class=&quot;reference&quot; href=&quot;http://en.wikipedia.org/wiki/Common_Language_Runtime&quot;&gt;CLR&lt;/a&gt;. &lt;a class=&quot;reference&quot; href=&quot;http://code.google.com/p/unladen-swallow/&quot;&gt;Unladen
Swallow&lt;/a&gt; is probably the one that&#39;s most similar to CrossTwine.&lt;/p&gt;
&lt;p&gt;CrossTwine considers CPython as a library and uses a set of C++ classes to
generate efficient interpreters that make calls to CPython&#39;s
internals. CrossTwine is a tool that helps improving performance by
hand-replacing some code paths with very efficient code that does the same
operations but bypasses the interpreter and its overhead. An interpreter built
with CrossTwine can be viewed as a JIT&#39;ed branch of the official Python
interpreter that should be feature-compatible (and bug-compatible) with CPython.
Damien calls he approach &amp;quot;punching holes in C substrate to get more speed&amp;quot; and
says it could probably be combined with Psyco for even better results.&lt;/p&gt;
&lt;p&gt;CrossTwine works on 64bit systems, but it is not (yet?) free software. It
focuses on some use cases to greatly improve speed and is not to be considered a
general purpose interpreter able to make any Python code faster.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;more-readings&quot;&gt;
&lt;h3&gt;&lt;a&gt;More readings&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;a class=&quot;reference&quot; href=&quot;http://cython.org/&quot;&gt;Cython&lt;/a&gt; is a language that makes writing C extensions for the Python language as
easy as Python itself. It replaces the older &lt;a class=&quot;reference&quot; href=&quot;http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/&quot;&gt;Pyrex&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The &lt;a class=&quot;reference&quot; href=&quot;http://conference.scipy.org/proceedings/SciPy2008/&quot;&gt;SciPy2008&lt;/a&gt; conference had at least two papers talking about speeding Python:
&lt;a class=&quot;reference&quot; href=&quot;http://conference.scipy.org/proceedings/SciPy2008/paper_16/&quot;&gt;Converting Python Functions to Dynamically Compiled C&lt;/a&gt; and
&lt;a class=&quot;reference&quot; href=&quot;http://conference.scipy.org/proceedings/SciPy2008/paper_17/&quot;&gt;unPython: Converting Python Numerical Programs into C&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;David Beazley gave a very interesting talk in 2009 at a Chicago Python Users group meeting about the effects of the
&lt;a class=&quot;reference&quot; href=&quot;http://www.dabeaz.com/python/GIL.pdf&quot;&gt;GIL on multicore&lt;/a&gt; machines.&lt;/p&gt;
&lt;p&gt;I will continue my report on the conference with the second part titled
&amp;quot;Applications And Open Questions&amp;quot;.&lt;/p&gt;
&lt;/div&gt;
</description>
  <dc:date>2009-07-29T20:43-01:00</dc:date>
  <dc:creator>Nicolas Chauvat</dc:creator>
</item>
  </channel>
</rss>