generic/519: Optimize overlap detection
authorNikolay Borisov <nborisov@suse.com>
Thu, 15 Aug 2019 10:22:40 +0000 (13:22 +0300)
committerEryu Guan <guaneryu@gmail.com>
Sun, 18 Aug 2019 15:05:45 +0000 (23:05 +0800)
commiteba73e34fd7eb8a9ecfc72723bb16bb03195dd8e
tree7d1f6fd0665c596a2cd8b6a6f5903c3cacc1d5f7
parent0d39941c0445cd4fc9d5316ce9f966318957367e
generic/519: Optimize overlap detection

Currently generic/519 takes around 5-10 minutes for me. This is
mainly due to the fact it uses a bunch of commands which spawn
processes. This, coupled by the fact the algorithm is O(n^2) in the
number of lines (624) for the sparse file and that test feels like
it's hung.

Fix this by re-implementing the existing logic in awk. This causes a
s single processes to be spawned and the rest of the processing is
done in-memory. This makes the test complete in 2 seconds for me.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
tests/generic/519