[pypy-dev] CFFI: better performance when calling a function from address

Carl Friedrich Bolz-Tereick cfbolz at gmx.de
Wed Sep 26 16:28:20 EDT 2018


Hi Armin,

Couldn't that slowness of getattr be fixed by making the lib objects eg use module dicts or something?

Cheers,

Carl Friedrich

On September 26, 2018 9:47:10 PM GMT+02:00, Armin Rigo <armin.rigo at gmail.com> wrote:
>Hi Dimitri,
>
>On Wed, 26 Sep 2018 at 21:19, Dimitri Vorona via pypy-dev
><pypy-dev at python.org> wrote:
>> In my microbenchmarks its has pretty much the same call performance
>as when using cffi ABI mode (dumping the functions to a shared library
>first) and is around 250ns per call slower than when using API mode.
>
>I doubt that these microbenchmarks are relevant.  But just in case, I
>found out that the JIT is producing two extra instructions in the ABI
>case, if you call ``lib.foobar()``.  These two instructions are caused
>by reading the ``foobar`` method on the ``lib`` object.  If you write
>instead ``foobar()``, with either ``foobar = lib.foobar`` or ``from
>_x_cffi.lib import foobar`` done earlier, then the speed is exactly
>the same.
>
>
>A bientôt,
>
>Armin.
>_______________________________________________
>pypy-dev mailing list
>pypy-dev at python.org
>https://mail.python.org/mailman/listinfo/pypy-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20180926/2fb3ae75/attachment.html>


More information about the pypy-dev mailing list