caching enabled status per logger by containmentbreach · Pull Request #799 · debug-js/debug
1 similar comment
Current implementation checks whether the namespace is enabled against the lists of regexes each time the debug instance is called. This change addresses this by caching the enabled flag in the debug instance to avoid reevaluating it each time. Since the library supports dynamically changing namespace configuration, the change also addresses this by caching reference to namespace config in the instance and comparing it against the current config (lazily). When the references are different the new config reference is replaces the previously cached one and the enabled flag reevaluated so nothing breaks but redundant regex checks are cut off.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, thanks!
Just a few small nitpicks and I'll merge.
Qix-
added
change-patch
and removed awaiting-response
This issue or pull request is awaiting a user's responselabels
Dec 9, 2020
debug-js
locked as spam and limited conversation to collaborators
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters