These are the benefits of storing the compiled code in RAM (in a
dict):

1. guaranteed compatible bytecode (its compiled on the server).
2. user does not need to remember to (re)compile the app before
uploading.
3. user does not need to hassle with any .pyc what so ever.
4. fastest possible code access (the entire goal is performance)
5. gets around the fact that you cannot write the file system.

When trying to upload compiled .pyc, the only 100% guaranteed way to
get compatible bytecode on the server would be to compile the bytecode
on the server itself.  Since appengine does not allow writing the pyc
to the file system, instead store the compiled bytecode in RAM, which
should always be as fast or faster than storing the bytecode on disk,
making no assumptions about disk caching.

Robin



On Oct 18, 7:04 pm, mdipierro <[EMAIL PROTECTED]> wrote:
> This is 
> interesting...http://code.google.com/p/appengine-monkey/issues/detail?id=8
>
> On Oct 18, 6:57 pm, mdipierro <[EMAIL PROTECTED]> wrote:
>
> > I see they are not exposing imp.get_magic() because they use a custom
> > interpreter.
>
> > Could you also try comment the following lines in compileapp.py and
> > see what happens?
>
> >     if data[:4]!=imp.get_magic():
> >         raise SystemError, "compiled code is incompatible"
>
> > It is unsafe but it is worth a try.
>
> > Massimo
>
> > On Oct 18, 6:47 pm, Robin B <[EMAIL PROTECTED]> wrote:
>
> > > When I uploaded compiled *.pyc and tried to run it, an error was
> > > raised, something about imp.get_magic not existing.  It might be
> > > possible to avoid imp.get_magic and get it loading, but I have not
> > > tried that.  I did try putting the code into a dict, and that sped
> > > things up.
>
> > > Robin
>
> > > On Oct 18, 5:55 pm, mdipierro <[EMAIL PROTECTED]> wrote:
>
> > > > Robin,
>
> > > > is it sufficient to byte-code compile the app and make sure the pyc
> > > > files (including gluon/*.pyc) are uploaded too or do we need to modify
> > > > web2py?
>
> > > > Massimo
>
> > > > On Oct 18, 5:28 pm, yarko <[EMAIL PROTECTED]> wrote:
>
> > > > > Sorry - I don't know about *.pyc files;  I assume they're not platform
> > > > > dependent, so I'm assuming that uploading *.pyc files with your app
> > > > > doesn't work (?).
>
> > > > > How is the Django support on GAE handling this issue?
>
> > > > > On Oct 18, 1:51 pm, Robin B <[EMAIL PROTECTED]> wrote:
>
> > > > > > In compileapp.py, after reading, parsing, and compiling a model, 
> > > > > > view,
> > > > > > or controller, if a .pyc cannot be written to disk, instead store 
> > > > > > the
> > > > > > compiled code, by file name/function, in a global dict so that next
> > > > > > request you can simply load the precompiled code directly from RAM.
>
> > > > > > Since web2py does not have an environment (does not distinguish
> > > > > > between development and production etc), the only way to update the
> > > > > > cached code is to check the mtime of each file on every request 
> > > > > > which
> > > > > > is wasteful in production where the code does not change, but not
> > > > > > nearly as wasteful as repeatedly reading, parsing and compiling.
>
> > > > > > Robin
>
> > > > > > On Oct 18, 10:27 am, mdipierro <[EMAIL PROTECTED]> wrote:
>
> > > > > > > On Oct 18, 9:51 am, Robin B <[EMAIL PROTECTED]> wrote:
>
> > > > > > > > Web2py 'works' on appengine, but it is reading, parsing and 
> > > > > > > > compiling
> > > > > > > > the models, controllers, and views on *every* request causing 
> > > > > > > > all the
> > > > > > > > wasted CPU cycles.  Normally, web2py caches code as .pyc files, 
> > > > > > > > but
> > > > > > > > you cannot write the filesystem on appengine so nothing gets 
> > > > > > > > cached by
> > > > > > > > default.  It is trivial to cache the compiled code in a dict 
> > > > > > > > and reuse
> > > > > > > > it on the next request.
>
> > > > > > > Could you explain more?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to