Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improving CUnitQueue performance: don't adjust mcount #2405

Conversation

maxsharabayko
Copy link
Collaborator

Extracted undisputed changes from PR #2395.

Do not adjust taken units in CUnitQueue::increase()

The re-estimation of the number of units taken in the CUnitQueue was previously done as a workaround for synchronization issues around simultaneous access to CUnitQueue::m_iCount.
Those issues should be fixed by now, e.g. #1333.
No point in this CPU-heavy loop anymore.

while (p != NULL)
{
	CUnit* u = p->m_pUnit;
	for (CUnit* end = u + p->m_iSize; u != end; ++u)
		if (u->m_iFlag != CUnit::FREE)
			++real_count;

	if (p == m_pLastQueue)
		p = NULL;
	else
		p = p->m_pNext;
}

CRcvQueue now tracks IP version instead of CUnitQueue

Previously CUnitQueue was tracking IP version. The value was submitted in CRcvQueue::init(..), and used by CRcvQueue::worker(..) thread. There is no use for the value in the CUnitQueue itself.
Therefore, moved to CRcvQueue.

Minor clean-up fix rethrowing an exception.

An exception was being caught in a named variable, while it was not referenced.

The adjustment was intended to patch issues around m_iCount. Those are not present anymore.
@maxsharabayko maxsharabayko added Type: Maintenance Work required to maintain or clean up the code [core] Area: Changes in SRT library core labels Jul 11, 2022
@maxsharabayko maxsharabayko added this to the Next Release milestone Jul 11, 2022
@maxsharabayko maxsharabayko force-pushed the hotfix/cunitqueue-dont-adjust-mcount branch from 81eb354 to 39ebcba Compare July 11, 2022 13:17
@maxsharabayko maxsharabayko merged commit b5055db into Haivision:master Jul 12, 2022
@maxsharabayko maxsharabayko deleted the hotfix/cunitqueue-dont-adjust-mcount branch July 12, 2022 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[core] Area: Changes in SRT library core Type: Maintenance Work required to maintain or clean up the code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant