Skip to content

[9.0] Add caches to asn1_utils for better performance#8155

Merged
fstagni merged 1 commit intoDIRACGrid:integrationfrom
chrisburr:asn1-caches
Apr 15, 2025
Merged

[9.0] Add caches to asn1_utils for better performance#8155
fstagni merged 1 commit intoDIRACGrid:integrationfrom
chrisburr:asn1-caches

Conversation

@chrisburr
Copy link
Copy Markdown
Member

BEGINRELEASENOTES

*Core
NEW: Add caches to asn1_utils for better performance

ENDRELEASENOTES

@chrisburr
Copy link
Copy Markdown
Member Author

I added the following to get some instrumentation on the cache:

import threading
import time

def cache_stats_monitor():
    while True:
        print("Cache stats for _extensionsFromCertDER:", _extensionsFromCertDER.cache_info())
        print("Cache stats for _decodeDIRACGroup  :", _decodeDIRACGroup.cache_info())
        # Wait for 5 seconds before printing the stats again
        time.sleep(5)

# Create and start a daemon thread to run the cache statistics monitor
monitor_thread = threading.Thread(target=cache_stats_monitor, daemon=True)
monitor_thread.start()
Cache stats for _extensionsFromCertDER: CacheInfo(hits=27212, misses=55, maxsize=1024, currsize=55)
Cache stats for _decodeDIRACGroup  : CacheInfo(hits=9106, misses=6, maxsize=128, currsize=6)

@fstagni fstagni merged commit 656920b into DIRACGrid:integration Apr 15, 2025
23 checks passed
@DIRACGridBot DIRACGridBot added the sweep:ignore Prevent sweeping from being ran for this PR label Apr 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sweep:ignore Prevent sweeping from being ran for this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants