Leopold Toetsch wrote:
Sorry about that. These hacks of course include pieces like...
Cool. Peace.
.... Furthermore, it is clear that operators like "sub_p_p_p" and "set_p_p_kic" will always perform better than callmethodcc_sc "__sub__" and callmethodcc_sc "__getitem__" respectively.
Well, and that's not true. I've already shown the opposite: Here are agains these numbers (-O3 build, AMD 800, 5 Meg operations):
MMD add PerlInt PerlInt 0.693220 MMD add PerlInt INTVAL 0.609069 MMD sub PerlInt PerlInt 0.475912 MMD sub PerlInt INTVAL 0.490149 PIR add PerlInt PerlInt 8.312403 PIR sub PerlInt PerlInt 4.562026
Please note the big speedup in the overloaded sub method.
In this table, are bigger numbers good or bad? Which of MMD or PIR corresponds to callmethod?
I would have assumed that sub mapped to MMD, and small (i.e., good) numbers, and that callmethod mapped to PIR and big (i.e., bad) numbers.
Am I reading this wrong?
I *don't* see a need to heavily optimize for rarely used mechanisms.
I'm not speaking of any optimization.
Rarely or not doesn't really matter, if we currently just can't do an equivalent of:
$ python
from cmath import sin sin(1+2j)
(3.1657785132161682+1.9596010414216058j)
as long as "sin" is just a plain opcode internally. The compiler will just emit a "sin" opcode. But *internally* its something like:
P_cmath_namespace."sin"(...)
I don't see a Python compiler ever emitting a "sin" opcode.
The code for pie-thon was based on the incorrect assumption that builtins are both global and reserved. The truth is that all such symbols are lexically scoped in Python.
Pirate currently emits the following code for "print sin(1+2j)":
.sub __main__ @MAIN new_pad 0 loadlib P1, "python_group" find_global P0, "PyBuiltin", "__load__" invoke push_eh __py_catch # find_type $I0, "PyObject" # (find_type:100) new $P0, $I0 # (infixExpression:394) find_type $I1, "PyInt" # (find_type:100) new $P1, $I1 # (expressConstant:254) $P1 = 1 # (expressConstant:255) find_type $I2, "PyComplex" # (find_type:100) new $P2, $I2 # (expressConstant:254) $P2 = "2j" # (expressConstant:255) $P0 = $P1 + $P2 # (infixExpression:404) find_lex $P4, 'sin' # (lookupName:142) $P3=$P4($P0) # (callingExpression:567) print_item $P3 # (visitPrint:675) print_newline # (visitPrintnl:680) # .return () __py_catch: set S0, P5['_message'] print S0 print "\n" .end