Skip to content

Commit

Permalink
better rowwise MT estimates in CBO
Browse files Browse the repository at this point in the history
  • Loading branch information
glookka committed Jul 8, 2023
1 parent 63687cb commit 6d03566
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
28 changes: 13 additions & 15 deletions src/costestimate.cpp
Expand Up @@ -47,6 +47,15 @@ static float EstimateMTCost ( float fCost, int iThreads, float fKPerf, float fBP


float EstimateMTCost ( float fCost, int iThreads )
{
const float fKPerf = 0.45f;
const float fBPerf = 1.40f;

return EstimateMTCost ( fCost, iThreads, fKPerf, fBPerf );
}


float EstimateMTCostCS ( float fCost, int iThreads )
{
const float fKPerf = 0.16f;
const float fBPerf = 1.38f;
Expand Down Expand Up @@ -118,8 +127,9 @@ class CostEstimate_c : public CostEstimate_i
float CalcAnalyzerCost() const;
float CalcLookupCost() const;
float CalcPushCost ( float fDocsAfterFilters ) const;
float CalcMTCost ( float fCost ) const;
float CalcMTCostSI ( float fCost ) const;
float CalcMTCost ( float fCost ) const { return EstimateMTCost ( fCost, m_tCtx.m_iThreads );}
float CalcMTCostCS ( float fCost ) const { return EstimateMTCostCS ( fCost, m_tCtx.m_iThreads );}
float CalcMTCostSI ( float fCost ) const { return EstimateMTCostSI ( fCost, m_tCtx.m_iThreads ); }

float CalcGetFilterComplexity ( const SecondaryIndexInfo_t & tSIInfo, const CSphFilterSettings & tFilter ) const;
bool NeedBitmapUnion ( const CSphFilterSettings & tFilter, int64_t iRsetSize ) const;
Expand Down Expand Up @@ -332,18 +342,6 @@ float CostEstimate_c::CalcPushCost ( float fDocsAfterFilters ) const
}


float CostEstimate_c::CalcMTCost ( float fCost ) const
{
return EstimateMTCost ( fCost, m_tCtx.m_iThreads );
}


float CostEstimate_c::CalcMTCostSI ( float fCost ) const
{
return EstimateMTCostSI ( fCost, m_tCtx.m_iThreads );
}


float CostEstimate_c::CalcQueryCost()
{
float fCost = 0.0f;
Expand Down Expand Up @@ -413,7 +411,7 @@ float CostEstimate_c::CalcQueryCost()
fCost += CalcPushCost(fDocsAfterFilters);

if ( !iNumLookups ) // docid lookups always run in a single thread
fCost = iNumIndexes ? CalcMTCostSI(fCost) : CalcMTCost(fCost);
fCost = iNumIndexes ? CalcMTCostSI(fCost) : ( iNumAnalyzers ? CalcMTCostCS(fCost) : CalcMTCost(fCost) );

return fCost;
}
Expand Down
1 change: 1 addition & 0 deletions src/costestimate.h
Expand Up @@ -21,6 +21,7 @@ class CostEstimate_i
};

float EstimateMTCost ( float fCost, int iThreads );
float EstimateMTCostCS ( float fCost, int iThreads );
float EstimateMTCostSI ( float fCost, int iThreads );
float EstimateMTCostSIFT ( float fCost, int iThreads );

Expand Down

0 comments on commit 6d03566

Please sign in to comment.