[pypy-dev] array performace?

Amaury Forgeot d'Arc amauryfa at gmail.com
Sat Jul 3 01:14:40 CEST 2010


2010/7/3 Bengt Richter <bokr at oz.net>:
> A thought/question:
> Could/does JIT make use of information in an assert statement? E.g., could we write
>     assert set(type(x) for x in img) == set([float]) and len(img)==640*480
> in front of a loop operating on img and have JIT use the info as assumed true
> even when "if __debug__:" suites are optimized away?
> Could such assertions allow e.g. a list to be implemented as a homogeneous vector
> of unboxed representations?
> What kind of guidelines for writing assertions would have to exist to make them
> useful to JIT most easily?

If efficient python code needs this, I'd better write the loop in C
and explicitly choose the types.
The C code could be inlined in the python script, and compiled on demand.
At least you'll know what you get.

Amaury Forgeot d'Arc

More information about the Pypy-dev mailing list