Jeremy> Imagine we didn't special case ints in BINARY_ADD. If you're Jeremy> doing mostly string addition, it's just slowing you down anyway Jeremy> :-). Instead, a function that expected to see ints would check Jeremy> the types of the relevant args. Jeremy> def f(x): Jeremy> return 2*x Jeremy> would become something like: Jeremy> def f(x): Jeremy> if isinstance(x, int): Jeremy> return 2 * x_as_int Jeremy> else: Jeremy> return 2 * x Jeremy> where the int branch could use opcodes that knew that x was an Jeremy> integer and could call its __add__ method directly. Yeah, but all you've really done is extract the current inline test for int arguments into a few more PyVM instructions. You've sacrificed a fairly fast special case test for more passes around the interpreter loop. I'm not sure how this can be a win in the current virtual machine. Skip
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4