DEV Community

Discussion on: Adventures in TrailDB with millions of rows, Python and Go

Collapse
 
aghost7 profile image
Jonathan Boudreau

What about running on pypy instead of cpython? Does it even run on pypy?

Collapse
 
rhymes profile image
rhymes • Edited

Excellent question, I didn't try at the time.

Apparently it does work! TrailDB uses ctypes which is compatible with pypy.

I've tried just now:

$ python --version
Python 2.7.13 (c925e7381036, Jun 05 2017, 20:53:58)
[PyPy 5.8.0 with GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)]

$ time python query_db_filter.py a.tdb
33.59s user 8.59s system 97% cpu 43.265 total

It's a little slower than CPython but it works, I think for this reason listed in pypy.org/features.html:

If all the time is spent in run-time libraries (i.e. in C functions), and not actually running Python code, the JIT compiler will not help.

Hope this helps!