summaryrefslogtreecommitdiffstats
path: root/examples/modules/sample-module/lib
diff options
context:
space:
mode:
authorBrice Figureau <brice-puppet@daysofwonder.com>2010-03-20 14:13:31 +0100
committerJames Turnbull <james@lovedthanlost.net>2010-03-25 12:00:46 +1100
commit56b575393bb9db99b25182d7d167a2768b561e6e (patch)
treee7cd99075472a85fc28f0a38a03c5316ac82cc61 /examples/modules/sample-module/lib
parent4b2b9ebfb566776373f48357e9df61a88b410faa (diff)
downloadpuppet-56b575393bb9db99b25182d7d167a2768b561e6e.tar.gz
puppet-56b575393bb9db99b25182d7d167a2768b561e6e.tar.xz
puppet-56b575393bb9db99b25182d7d167a2768b561e6e.zip
Fix inefficient SimpleGraph#matching_edge
This method has two issues: * it is inefficient when there are many events * it tries to match edges that shouldn't be matched With recursive file resources, many change events can be generated. The method used to find the good ones is pretty inefficient, allocating arrays and/or appending to arrays which is a slow operation that can consume lot of memory. Still with recursife file resources, the current code tries to match the events with edges pointing to generated sub-file-resources, which is not necessary. In fact this all happens because we masquerade the sub-generated resources with the topmost resource whic itself has auto-required links to them. There is no reason to send back those events to where they were generated. This patch tries to minimize allocations or array appending, it also collect event names (instead of events themselve) while matching since there are great chances there are way less events names than events (and we're matchin by name). This patch also makes sure we select only edges that don't point back to the event sources. Results for matching 1100 events: * old code: 22s * new code: 0.02s This patch also helps on the memory consumption side since the GC has almost no work to perform. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
Diffstat (limited to 'examples/modules/sample-module/lib')
0 files changed, 0 insertions, 0 deletions