gem/oq-engine — pull request #1178 by micheles (2013-05-12 05:37:46+00:00)
Title: Saved memory in the hazard getters by returning only the distinct GMFs

See https://bugs.launchpad.net/oq-engine/+bug/1175941 for the context.
The speedups and memory saving of this small change are impressive. My tests on Cobain show a speedup in the hazard getters of 5 times (in the case of Miriam's island with 100 SES) and a memory saving of 8 times. The solution here should be considered a workaround: there is a much better approach that I wanted to implement, but it requires changing how the distribution works in the risk calculators and it would be a long and difficult project, involving a lot of preliminary refactoring and adding new tables to the database. But we must go there, eventually.