MCPcopy Index your code
hub / github.com/uber/aresdb / estimateSortReduceMemUsage

Function estimateSortReduceMemUsage

query/aql_processor.go:1198–1210  ·  view source on GitHub ↗

Note: we only calculate Sort memory usage since sort memory usage is larger than reduce and we only care about the maximum

(inputSize int)

Source from the content-addressed store, hash-verified

1196// since sort memory usage is larger than reduce
1197// and we only care about the maximum
1198func estimateSortReduceMemUsage(inputSize int) (memUsage int) {
1199 // dimension index vector
1200 // 4 byte for uint32
1201 // 2 vectors for input and output
1202 memUsage += inputSize * 4 * 2
1203 // hash vector
1204 // 8 byte for uint64 hash value
1205 // 2 vectors for input and output
1206 memUsage += inputSize * 8 * 2
1207 // we sort dim index values as value, and hash value as key
1208 memUsage += inputSize * (8 + 4)
1209 return
1210}
1211
1212// estimateScratchSpaceMemUsage calculates memory usage for an expression
1213func estimateScratchSpaceMemUsage(exp expr.Expr, firstColumnSize int, isRoot bool) (int, int) {

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected