arvindm95 / unladen-swallow

Automatically exported from code.google.com/p/unladen-swallow
Other
0 stars 0 forks source link

Share code objects between identical functions #49

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
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

GoogleCodeExporter commented 8 years ago
Too low priority.

Original comment by collinw on 20 Jan 2010 at 6:27