On Thu, Aug 02, 2001 at 10:30:06AM -0700, Simon Cozens wrote: > On Wed, Aug 01, 2001 at 12:42:42AM -0400, Tim Peters wrote: > > case BINARY_DIVIDE: > case? Wowsers. Hey, Ruby does that too. We use function pointers, > FWIW. Well, we use *both* :) But function-pointers alone aren't enough, are they ? Or are the bytecodes themselves the function pointers ? *shudder*. I guess you do opcodes as indices into an array-of-function-pointers ? There was talk about doing that for Python too, but I believe it ended up being not significantly faster. Some people have seen bigger speedups just reorganizing the case's in the Big Switch, but those same changes slowed things down on other platforms. > Oh, and here's our divide, for comparison: > In slightly more pseudo code: > PP(pp_divide) > { > get_the_stack_pointer; > find_somewhere_to_put_result; > check_if_overloaded; > { > NV right = SvNV(POP); > NV left = SvNV(POP); > NV value; > if (right == 0.0) > DIE(aTHX_ "Illegal division by zero"); > value = left / right; > PUSHn( value ); > RETURN; > } > } Right... Almost the same, except that the check_if_overloaded is a bigger check for Python, and more often true (I suspect.) And, as was said before, assignment isn't a value-filling operation, so instead of 'value = left / right' we have 'PyObject *value = new_object(left / right)' (pseudocode, again) and just push value onto the stack (to be stored into a variable by a subsequent opcode, or just kept in the stack for the running expression.) -- Thomas Wouters <thomas@xs4all.net> Hi! I'm a .signature virus! copy me into your .signature file to help me spread!
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