Turns out that version numbers aren't as random as you might guess.
In my cache for example, I have:
Total package names: 69513 (1390 k)
Total package structures: 188259 (9036 k)
Total distinct versions: 186345 (13.4 M)
Total dependencies:
2052242 (57.5 M)
which amounts to
1035873 (10,1 M) strings.
Reusing version strings reduces this to 161465 (3.479 k).
This comes at a cost of course: Generation is slightly slower, but we
are still faster than what we started with and it makes room (also cache
size wise) for further changes.
return false;
Grp = pkgCache::GrpIterator(Cache, Cache.GrpP + Group);
return false;
Grp = pkgCache::GrpIterator(Cache, Cache.GrpP + Group);
- map_pointer_t const idxName = WriteStringInMap(Name);
+ map_stringitem_t const idxName = StoreString(PKGNAME, Name);
if (unlikely(idxName == 0))
return false;
Grp->Name = idxName;
if (unlikely(idxName == 0))
return false;
Grp->Name = idxName;
}
}
// haven't found the version string, so create
}
}
// haven't found the version string, so create
- map_stringitem_t const idxVerStr = WriteStringInMap(VerStr);
+ map_stringitem_t const idxVerStr = StoreString(VERSION, VerStr);
if (unlikely(idxVerStr == 0))
return 0;
Ver->VerStr = idxVerStr;
if (unlikely(idxVerStr == 0))
return 0;
Ver->VerStr = idxVerStr;
if (index == 0)
{
void const * const oldMap = Map.Data();
if (index == 0)
{
void const * const oldMap = Map.Data();
- index = WriteStringInMap(Version);
+ index = StoreString(VERSION, Version);
if (unlikely(index == 0))
return false;
if (OldDepLast != 0 && oldMap != Map.Data())
if (unlikely(index == 0))
return false;
if (OldDepLast != 0 && oldMap != Map.Data())