ENHANCEMENT Ticket (in progress)

HgAdapter: counting lines of code is incredibly slow

I suspect this is caused by cat_file() being very slow. Large repositories effectively take infinite time to count.
on 03.10.09 reported by: robinluckey owned by: robinluckey
on 03.24.09 by robinluckey
- **type** was changed to _enhancement_
on 07.07.09 by robinluckey
  • owner was changed to robinluckey
  • status was changed to in progress
I have made a change in commit 3892a5ced5b21254a3979d46f63262700f060028 which speeds up the process. The main problem was in cat_file_parent(), which was previously a three-step process. Each step required spawning a shell and issuing a command to Hg. It turns out that one of these steps was unnecessary, and I was able to reduce it to a two-step process. The step I eliminated ("hg log -v -r") was very slow for a commit with thousands of diffs. Since we issued this command once for each diff in the commit, the slow-down was essentially O(n^2) with the number of diffs in the commit. It's still pokey, but much better. I'm leaving the bug open for future improvements.