Re: efficiency question
- From: "MTD" <marc.t.davies@xxxxxxxxx>
- Date: 30 Jun 2006 05:00:45 -0700
For the sake of comparison:
.... tupple1 = ("abc", "def", "xyz")def cod(x):
.... tupple2 = ("pqr", "tuv", "123")
.... if x in tupple1:
.... doStuff()
.... elif x in tupple2:
.... doOtherStuff()
....
2 0 LOAD_CONST 7 (('abc', 'def', 'xyz'))dis.dis(cod)
3 STORE_FAST 2 (tupple1)
3 6 LOAD_CONST 8 (('pqr', 'tuv', '123'))
9 STORE_FAST 1 (tupple2)
4 12 LOAD_FAST 0 (x)
15 LOAD_FAST 2 (tupple1)
18 COMPARE_OP 6 (in)
21 JUMP_IF_FALSE 11 (to 35)
24 POP_TOP
5 25 LOAD_GLOBAL 3 (doStuff)
28 CALL_FUNCTION 0
31 POP_TOP
32 JUMP_FORWARD 25 (to 60)
>> 35 POP_TOP
6 36 LOAD_FAST 0 (x)
39 LOAD_FAST 1 (tupple2)
42 COMPARE_OP 6 (in)
45 JUMP_IF_FALSE 11 (to 59)
48 POP_TOP
7 49 LOAD_GLOBAL 4 (doOtherStuff)
52 CALL_FUNCTION 0
55 POP_TOP
56 JUMP_FORWARD 1 (to 60)
>> 59 POP_TOP
>> 60 LOAD_CONST 0 (None)
63 RETURN_VALUE
.
- Follow-Ups:
- Re: efficiency question
- From: diffuser78
- Re: efficiency question
- References:
- Re: efficiency question
- From: Fredrik Lundh
- Re: efficiency question
- Prev by Date: Re: Way for see if dict has a key
- Next by Date: Re: logging error with RotatingFileHandler
- Previous by thread: Re: efficiency question
- Next by thread: Re: efficiency question
- Index(es):