1. jtn
  2. cached_thg


Clone wiki

cached_thg / Investigation



  • Number of revision has serious impact on performance.
  • Number of versioned files has huge impact on perfomance.


  • cpython repo with 72000+ commits works reasonably fast, but it contains only 3700 files.
  • Netbeans repo with 198000+ commits and 78000+ files is unusable in thg.


  • Most of the time is spent in HgFileListModel.setContext() [filelistmodel.py] which includes costly calls to:
    • self.loadFiles()
      • one or two calls to _buildDesc()
        • thgchangectx.changesToParent()
    • self.layoutChanged.emit()

The changesToParent() function calls very costly _repo.status(parent.node(), self.node()) to get file lists or whatever. Using a simple result cache here improves performance dramatically (see section Stage 1 on the Home page).

The remaining lag is caused by layoutChanged.emit() to display file/diff. I've altered filelistview so the user must click a file to view it contents. Those two changes together made thg workbench usable with the netbeans repo (see section Stage 2 on the Home page).

There is another path to changesToParent() when you add the "Changes" column to the repo browser:

[htmldelegate.py] paint
[htmldelegate.py] _buildoc
[repomodel.py] data
[repomodel.py] ...
[repomodel.py] getchanges
[thgrepo.py] changesToParent

Adding the "Changes" columns kills thg completely on large repos...