Changeset 530 for trunk/lib/Stats.cc


Ignore:
Timestamp:
Dec 25, 2007, 2:59:58 PM (14 years ago)
Author:
Peter Johansson
Message:

For large projects, i.e. many files and many contributors, the statistics is typically not changing between tow revisisions for a specific file and author. Therefore, we are caching the 'differentiated' stats instead. This will be sparse (contain mostly zeros) so we can use a sparse notation and typically save disc space i.e. read/write time.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Stats.cc

    r529 r530  
    179179        continue;
    180180      std::vector<u_int>& vec=m[name];
    181       size_t revs=0;
    182       is >> revs;
    183       vec.reserve(revs);
    184       while (vec.size() < revs && is.good()) {
    185         u_int tmp;
    186         is >> tmp;
    187         vec.push_back(tmp);
     181      svn_revnum_t rev=0;
     182      while (rev < last_changed_rev() && is.good()) {
     183        u_int count;
     184        is >> count;
     185        if ( rev+1 > static_cast<svn_revnum_t>(vec.size()) )
     186        vec.resize(rev+1);
     187        vec[rev] = count;
     188        is >> rev;
    188189      }
    189190    }
     
    413414    for (A2VConstIter i(m.begin()); i!=m.end(); ++i){
    414415      os << i->first << "\n";
    415       os << i->second.size() << " ";
    416       std::copy(i->second.begin(), i->second.end(),
    417                 std::ostream_iterator<u_int>(os, " "));
     416      os << i->second.front() << " ";
     417      for (size_t j=1; j<i->second.size(); ++j)
     418        if (i->second[j] != i->second[j-1])
     419          os << j << " " << i->second[j] - i->second[j-1] << " ";
     420      os << last_changed_rev()+1 << " ";
    418421    }
    419422  }
Note: See TracChangeset for help on using the changeset viewer.