Hi, On 15 July 2014 18:37, Eleytherios Stamatogiannakis <est...@gmail.com> wrote: > t = type(var) > if t is int: > i(v) > elif t is long: > l(v) > elif t is float: > f(v) > elif t is str: > s(v) > elif t is unicode: > u(v) > ...
This should already give you the fastest possible execution on PyPy, because the first type inspection should promote the type in the JIT. All subsequent "if" checks are constant-folded. However, to be sure, you need to check with jitviewer. Note however that if all paths are eventually compiled by the JIT, the promotion will have a number of different cases, and searching through them is again done by linear search for now. This can be regarded as a bug waiting for improvement. A bientôt, Armin. _______________________________________________ pypy-dev mailing list pypy-dev@python.org https://mail.python.org/mailman/listinfo/pypy-dev