Skip to content

Conversation

@langbeck
Copy link

@langbeck langbeck commented Oct 5, 2025

When zapcore.LevelOf is called with a zapcore.nopCore{}, it does one type assertion to determine that it doesn't implement leveledEnabler, then it calls Enabled 6 times on it before returning InvalidLevel. By implementing leveledEnabler and making it return InvalidLevel, we can greatly decrease the cost of calling zapcore.LevelOf on nop cores.

@CLAassistant
Copy link

CLAassistant commented Oct 5, 2025

CLA assistant check
All committers have signed the CLA.

@langbeck langbeck force-pushed the langbeck/implement-leveledenabler-for-nopcore branch from 59fdd09 to 7d1b424 Compare October 5, 2025 00:41
Copy link
Collaborator

@prashantv prashantv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you share more details about a scenario where the multiple calls to Enabled has a high performance cost, and is showing up in profiles?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants