So I enhanced the PVM dynamic execution profiler to keep track of quads of instructions rather than just pairs. Running it on PyStone, I get the following results: Note: score is frequency * len(trace) http://www.bitfurnace.com/python/dxstats-traces.txt score trace 7204142 LOAD_FAST 3701796 LOAD_FAST, LOAD_FAST 3453243 COMPARE_OP, JUMP_IF_FALSE, POP_TOP 2701110 LOAD_GLOBAL 2603086 JUMP_IF_FALSE, POP_TOP 2402196 COMPARE_OP, JUMP_IF_FALSE 2302782 LOAD_CONST 2251111 STORE_FAST 2200676 LOAD_GLOBAL, COMPARE_OP, JUMP_IF_FALSE, POP_TOP 2101580 LOAD_FAST, LOAD_CONST 2100896 STORE_FAST, LOAD_FAST 2000188 COMPARE_OP, JUMP_IF_FALSE, POP_TOP, LOAD_GLOBAL 1800639 LOAD_FAST, LOAD_CONST, BINARY_ADD 1650507 LOAD_GLOBAL, COMPARE_OP, JUMP_IF_FALSE 1650177 JUMP_IF_FALSE, POP_TOP, LOAD_GLOBAL 1600986 LOAD_GLOBAL, LOAD_FAST 1600492 LOAD_FAST, LOAD_GLOBAL, COMPARE_OP, JUMP_IF_FALSE 1500536 LOAD_CONST, BINARY_ADD 1500339 STORE_FAST, LOAD_FAST, LOAD_FAST 1500282 LOAD_FAST, STORE_ATTR 1452043 POP_TOP 1400524 LOAD_FAST, LOAD_CONST, BINARY_ADD, STORE_FAST 1400056 LOAD_FAST, LOAD_FAST, BINARY_SUBSCR, LOAD_FAST 1351596 JUMP_IF_FALSE 1300164 POP_TOP, LOAD_GLOBAL 1251127 COMPARE_OP 1203536 COMPARE_OP, JUMP_IF_FALSE, POP_TOP, LOAD_FAST ... certainly, making JUMPs consume the top-of-stack still seems worthwhile other possibilities LOAD_FAST+FAST == LOAD_FAST, LOAD_FAST JUMP_IF_CMP == COMPARE_OP, JUMP_IF_FALSE -- consumes two items off the stack LOAD_FAST+CONST == LOAD_FAST, LOAD_CONST ADD_CONST == LOAD_CONST, BINARY_ADD FAST_SUBSCR == LOAD_FAST, LOAD_FAST, BINARY_SUBSCR If anyone has any suggestions of a better app than PyStone to profile, I would be grateful.
participants (6)
-
damien morton
-
Damien Morton
-
Guido van Rossum
-
Jeremy Hylton
-
M.-A. Lemburg
-
Skip Montanaro