[sugar] Activities are recompiled on every launch
Benjamin M. Schwartz
bmschwar
Sun Mar 23 20:05:27 EDT 2008
-----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.
- --Ben
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFH5vBHUJT6e6HFtqQRAt4eAJ9tnEyjc1N6npQAiEfoIZ73T/f6awCgij2r
klZpTTgUpBBWpACXtR8Gt44=
=Dt6N
-----END PGP SIGNATURE-----
More information about the Sugar-devel
mailing list