[sugar] Activities are recompiled on every launch

Tomeu Vizoso tomeu
Mon Apr 7 06:08:19 EDT 2008


On Mon, Mar 24, 2008 at 2:05 AM, Benjamin M. Schwartz
<bmschwar at fas.harvard.edu> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
>  Hash: SHA1
>
>
> Martin Langhoff wrote:
>  | On Sun, Mar 23, 2008 at 7:02 PM, Benjamin M. Schwartz
>  | <bmschwar at fas.harvard.edu> wrote:
>  |>  # time python -c "import compileall;
>  |>  compileall.compile_dir('/usr/share/activities/TamTamEdit.activity/',
>  |>  force=True, quiet=True)"
>  |>  real  0m3.902s
>  |>  user  0m3.460s
>  |>  sys 0m0.440s
>  |>
>  |>  All measurements were made multiple times to ensure cached reads.  The
>  |
>  | That's a quick turnaround ;-) Do we know who implemented the python
>  | support for all this?
>
>  I don't, but it hasn't changed much for a decade or more.
>
>
>  | It sounds like it is a safety feature - or an
>  | "avoid running stale code" feature - that it won't use a pyo file from
>  | a script named in the commandline. In other words, it should be
>  | trivial to get Python to use it.
>
>  If you're proposing to patch the python interpreter...that sounds like too
>  much work.  Instead of running "python foo.py", you can do "python
>  foo.pyc" or "python foo.pyo" and it just works.  Also, I think the faster
>  branch doesn't invoke the "/usr/bin/python" binary for launches anyway.
>
>  If I understand correctly, Tomeu's faster-launch implementation loads the
>  activity's .py files using the "import" statement, and the "import"
>  statement automatically uses a .pyc file if its timestamp is newer than
>  the .py file's timestamp.  So all we have to is make sure the .pyc files
>  are present and python will do the rest.

Can we check in the latest faster or joyride builds how much of a
difference makes having the correct .pyc files when starting a python
activity like Chat? Also would be interesting to see how much
difference makes when starting up the Sugar shell.

If you are busy now, I'll take this measurements myself later
(hopefully this week).

Thanks,

Tomeu



More information about the Sugar-devel mailing list