sluggish start time; files created in pwd

27 views
Skip to first unread message

Crusader Ky

unread,
Dec 18, 2014, 10:41:01 AM12/18/14
to pytho...@googlegroups.com
Hi,
I'm running this hello world:

#!/usr/bin/env python

import cffi
ffi
= cffi.FFI()
ffi
.cdef(r"""
    void hello();
"""
)
C
= ffi.verify(r"""
    #include <stdio.h>
    void hello(void) {
        printf("
Hello world!\n");
    }
"""
)

if __name__ == '__main__':
    C
.hello()


On Ubuntu 14.04, Python 2.7.6, pycparser 2.10, CFFI 0.8.2,
it takes 200ms for the first run and 45ms for the subsequent ones,
and it creates .__pycache__ under $HOME/.

On my office environment, RedHat 5, Python 2.6.2 installed in a custom location, pycparser 2.10 and CFFI 0.8.6 (both built from sources and installed in a custom location),
it takes 2s on the first run and 1.5s for the subsequent ones thereafter,
and it creates .__pycache__, yacctab.py and lextab.py in the current directory.

This is how I build them:

tar -xzf pycparser-release_v2.10.tar.gz
cd pycparser-release_v2.10
python setup.py --prefix=/my/custom/root
cd ..

tar -xzf cffi-0.8.6.tar.gz
cd cffi-0.8.6
python setup.py --prefix=/my/custom/root
cd ..


Thanks in advance

Armin Rigo

unread,
Dec 18, 2014, 11:16:05 AM12/18/14
to pytho...@googlegroups.com
Hi,

On 18 December 2014 at 15:41, Crusader Ky <crusa...@gmail.com> wrote:
> On my office environment, RedHat 5, Python 2.6.2 installed in a custom
> location, pycparser 2.10 and CFFI 0.8.6 (both built from sources and
> installed in a custom location),
> it takes 2s on the first run and 1.5s for the subsequent ones thereafter,
> and it creates .__pycache__, yacctab.py and lextab.py in the current
> directory.

This is due to a misinstalled ``pycparser``. It is not finding its
precomputed C yacc and lex files, and so it creates them afresh in the
current directory. I'm not 100% sure how a correctly-installed
pycparser should look like, but I suggest that you do ``pip install
cffi`` (which will do ``pip install pycparser``) if possible, or if
not, try to figure out what's different in your pycparser installation
when compared against the machine where it works.


A bientôt,

Armin.

Crusader Ky

unread,
Dec 19, 2014, 11:26:13 AM12/19/14
to pytho...@googlegroups.com
Fixed

tar -xzf pycparser-release_v2.10.tar.gz
cd pycparser
-release_v2.10

cd pycparser
/
python _build_tables
.py
cd
..
python setup
.py install --prefix=/my/custom/root
cd
..
Reply all
Reply to author
Forward
0 new messages