Optimise codegen for Python OpCode classes
authorBrian Foley <bpfoley@google.com>
Wed, 27 Jan 2016 19:23:23 +0000 (19:23 +0000)
committerHelga Velroyen <helgav@google.com>
Thu, 28 Jan 2016 15:15:47 +0000 (16:15 +0100)
commitcda51aad9c197377e33429bfd9994a223b1ad9ad
tree59df4153023b4cfc36f22c710bc95089da42b2ad
parent4b7cd46ff19d5c5742a359eab37d2ae5593d93cf
Optimise codegen for Python OpCode classes

This makes hs2py output types like ht.TMaybeBool instead of
ht.TMaybe(ht.TBool). The two have equivalent behaviour, but Python
creates a new callable object at runtime for each instance of the
second, because TMaybe is a higher order function.

This optimisation saves >500kB of heap for "import opcodes" for every
Ganeti Python process.

Signed-off-by: Brian Foley <bpfoley@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
src/Ganeti/THH/PyType.hs