| 342 | |
| 343 | template <typename CType, typename Container> |
| 344 | bool ShouldUseCountMode(const Container& values, int64_t num_valid, CType* min, |
| 345 | CType* max) { |
| 346 | // cross point to benefit from counting approach |
| 347 | // about 2x improvement for int32/64 from micro-benchmarking |
| 348 | static constexpr int kMinArraySize = 8192; |
| 349 | static constexpr int kMaxValueRange = 32768; |
| 350 | |
| 351 | if (num_valid >= kMinArraySize) { |
| 352 | std::tie(*min, *max) = GetMinMax<CType>(values); |
| 353 | return static_cast<uint64_t>(*max) - static_cast<uint64_t>(*min) <= kMaxValueRange; |
| 354 | } |
| 355 | return false; |
| 356 | } |
| 357 | |
| 358 | // pick counting or sorting approach per integers value range |
| 359 | template <typename T> |
nothing calls this directly
no outgoing calls
no test coverage detected