http://morepypy.blogspot.com/2010/03/hello.html
I can't wait to download it on the mac tonight and see if web2py runs
"out of the box". Do we have any easy way of benching performance
under PyPy? I'm a little concerned about the "exec" method of
executing code not "playing well" with the PyPy JIT.
I'm gettng a Sqlite3 error whenever I try to run a site:
Traceback (most recent call last):
File "/Users/xxx/Work/web2py/gluon/restricted.py", line 173, in
restricted
exec ccode in environment
File "/Users/xxx/Work/web2py/applications/yyy/models/db.py", line 9,
in <module>
db=SQLDB('sqlite://swim.db') # if not, use SQLite or
other DB
File "/Users/xxx/Work/web2py/gluon/sql.py", line 889, in __init__
self._pool_connection(lambda : sqlite3.Connection(dbpath,
File "/Users/xxx/Work/web2py/gluon/sql.py", line 829, in
_pool_connection
self._connection = f()
File "/Users/xxx/Work/web2py/gluon/sql.py", line 889, in <lambda>
self._pool_connection(lambda : sqlite3.Connection(dbpath,
AttributeError: 'module' object has no attribute 'Connection'
I discovered that sqlite3 was not being loaded by sql.py in gluon.
The library must be structured oddly because it wants something like:
from sqlite3 import dbapi2 as sqlite3
After hacking sql.py in this fashion, pypy ran perfectly! ...for
about 30 seconds!
After that time, I got a "too many open files" error for every
request. It seems that PyPy isn't very aggressive about GC'ing closed
files, so I need to research that aspect.
It may be a moot question, because from my brief tests I believe the
JIT will not speed up code loaded and run via "exec". I noticed my
worst page load takes about 6-7 seconds under OSX Python 2.5.2 but
takes about 12 seconds under PyPy.
On Mar 20, 2:58 pm, Joe Barnhart <joe.barnh...@gmail.com> wrote:
> OK -- more info.
>
> I discovered that sqlite3 was not being loaded by sql.py in gluon.
> The library must be structured oddly because it wants something like:
>
> from sqlite3 import dbapi2 as sqlite3
Can you send me the patch?
> After hacking sql.py in this fashion, pypy ran perfectly! ...for
> about 30 seconds!
>
> After that time, I got a "too many open files" error for every
> request. It seems that PyPy isn't very aggressive about GC'ing closed
> files, so I need to research that aspect.
This is bad. I think we explicitly close any file we open but we may
be wrong. If you find out the source of the problem, please let me
know.
But next time, I'll be better prepared to send you a patch. I'm up to
date and pulling the latest sources now -- I don't want to be a bad
citizen by sending patches on old code.
I think I'll nose around a little and see if I can discover where the
files are not being closed. The PyPy site specifically states that
files do NOT get closed automatically when they go out of scope (seem
like kind of a big difference to me) so that is where I will look.
Joe Barnhart
I agree with you that not closing files when they go out of scope is a
major incompatibility.
Massimo