Browse Source

Removed statistics in BitVectorHashmap which were only used for debugging purposes

tempestpy_adaptions
Matthias Volk 6 years ago
parent
commit
46e39e6a6e
  1. 23
      src/storm/storage/BitVectorHashMap.cpp
  2. 7
      src/storm/storage/BitVectorHashMap.h

23
src/storm/storage/BitVectorHashMap.cpp

@ -54,13 +54,6 @@ namespace storm {
buckets = storm::storage::BitVector(bucketSize * (1ull << currentSize));
occupied = storm::storage::BitVector(1ull << currentSize);
values = std::vector<ValueType>(1ull << currentSize);
#ifndef NDEBUG
numberOfInsertions = 0;
numberOfInsertionProbingSteps = 0;
numberOfFinds = 0;
numberOfFindProbingSteps = 0;
#endif
}
template<class ValueType, class Hash>
@ -81,11 +74,7 @@ namespace storm {
template<class ValueType, class Hash>
void BitVectorHashMap<ValueType, Hash>::increaseSize() {
++currentSize;
#ifndef NDEBUG
STORM_LOG_TRACE("Increasing size of hash map from " << (1ull << (currentSize - 1)) << " to " << (1ull << currentSize) << ". Stats: " << numberOfFinds << " finds (avg. " << (numberOfFindProbingSteps / static_cast<double>(numberOfFinds)) << " probing steps), " << numberOfInsertions << " insertions (avg. " << (numberOfInsertionProbingSteps / static_cast<double>(numberOfInsertions)) << " probing steps).");
#else
STORM_LOG_TRACE("Increasing size of hash map from " << (1ull << (currentSize - 1)) << " to " << (1ull << currentSize) << ".");
#endif
// Create new containers and swap them with the old ones.
storm::storage::BitVector oldBuckets(bucketSize * (1ull << currentSize));
@ -170,15 +159,9 @@ namespace storm {
template<class ValueType, class Hash>
std::pair<bool, uint64_t> BitVectorHashMap<ValueType, Hash>::findBucket(storm::storage::BitVector const& key) const {
#ifndef NDEBUG
++numberOfFinds;
#endif
uint64_t bucket = hasher(key) >> this->getCurrentShiftWidth();
while (isBucketOccupied(bucket)) {
#ifndef NDEBUG
++numberOfFindProbingSteps;
#endif
if (buckets.matches(bucket * bucketSize, key)) {
return std::make_pair(true, bucket);
}
@ -193,15 +176,9 @@ namespace storm {
template<class ValueType, class Hash>
std::pair<bool, uint64_t> BitVectorHashMap<ValueType, Hash>::findBucketToInsert(storm::storage::BitVector const& key) {
#ifndef NDEBUG
++numberOfInsertions;
#endif
uint64_t bucket = hasher(key) >> this->getCurrentShiftWidth();
while (isBucketOccupied(bucket)) {
#ifndef NDEBUG
++numberOfInsertionProbingSteps;
#endif
if (buckets.matches(bucket * bucketSize, key)) {
return std::make_pair(true, bucket);
}

7
src/storm/storage/BitVectorHashMap.h

@ -234,13 +234,6 @@ namespace storm {
// Functor object that are used to perform the actual hashing.
Hash hasher;
#ifndef NDEBUG
// Some performance metrics.
mutable uint64_t numberOfInsertions;
mutable uint64_t numberOfInsertionProbingSteps;
mutable uint64_t numberOfFinds;
mutable uint64_t numberOfFindProbingSteps;
#endif
};
}

Loading…
Cancel
Save