erlang/otp — pull request #450 by hanssv (2014-08-18 08:43:10+00:00)
Title: [tools/cover] Remove bottleneck in reset/0

do_reset/1 tried to avoid building long lists by resetting one
clause at a time. However, if the modules are large,
ets:match_object will take enough time to make reset/0 relly
slow. Thus, it is better to reset one module at a time.

We observed that our test suite was spending significant time (~10s) resetting cover - The issue was that to avoid building "long lists" reset was done on a per-clause basis, where each reset contained a call to ets:match_object.

It should be a safe optimization to assume that the list of clauses/lines fits in memory. (If that is not the case reset/0 will hardly be the main problem!)

While covering ~30 medium sized modules (~50 clauses per module) this patch reduced the time for reset/0 from 340ms to 8ms. And for the full test suite 6600ms was reduced to 30ms.