This idea is more speculative: every "def foo(): pass" function has the
same bytecode. It might reduce memory usage if we should share the
implementation of these functions between function definitions. This could
be done by hashing the function's parameters and bytecode.
Issues:
- Hashing the AST might be better than hashing the bytecode.
- If two functions have the same bytecode but different parameter names,
they probably can't take advantage of this. In the example above, "def
foo(): pass" and "def bar(a): pass" can't share an implementation
I'd be interested to know, for an application like 2to3 or Django's test
suite, how many functions are really the same (modulo their name).
Original issue reported on code.google.com by collinw on 6 Jun 2009 at 12:07
Original issue reported on code.google.com by
collinw
on 6 Jun 2009 at 12:07