TGViewer
Находки в опенсорсе: Python Находки в опенсорсе: Python @opensource_findings_python · 1.06K subscribers
Post #163 1.17K
🚀 New issue to wemake-services/django-modern-rest by @sobolevn
📝 Optimize _is_validation_enabled by using cache (#230)

This method is in hot-path, it is called for every response: https://github.com/wemake-services/django-modern-rest/blob/c6071d9907c72a54258bc7f644822e91640559d4/djangomodernrest/validation.py#L137-L162

So, we need to optimize it to the max. I propose to:

1. Make a function out of this method

2. Use @lru_cache(maxsize=MAX_CACHE_SIZE) as we do in other places to cache the function result (since the result can't change for a given endpoint / controller)

3. Profit!

#enhancement #goodfirstissue #help_wanted

sent via relator
  • 🤩 1
More from @opensource_findings_python
  1. Sep 27, 2026🚀 New issue to wemake-services/wemake-python-styleguide by @sobolevn 📝 `WPS235`: ignore…
  2. Sep 27, 2026🚀 New issue to wemake-services/django-modern-rest by @vyhuholl 📝 Seeded OpenAPI examples…
  3. Sep 25, 2026🚀 New issue to wemake-services/django-modern-rest by @sobolevn 📝 `Settings.throttling_al…
  4. Sep 25, 2026🚀 New issue to wemake-services/wemake-python-styleguide by @sobolevn 📝 Incorrect Jones c…
  5. Sep 25, 2026🚀 New issue to wemake-services/django-modern-rest by @sobolevn 📝 `_validate_throttling`…
  6. Sep 24, 2026🚀 New issue to wemake-services/django-modern-rest by @sobolevn 📝 Flaky `test_empty_valid…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →