-
Notifications
You must be signed in to change notification settings - Fork 215
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Only calculate hash once for Marker objects #513
Conversation
voluptuous/schema_builder.py
Outdated
description: typing.Optional[str] = None, | ||
) -> None: | ||
super().__init__(schema_, msg, description) | ||
self.__hash__ = lru_cache(maxsize=None)(lambda: object.__hash__(self)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this necessary? Doesn't Marker.__hash__
cover this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its overriding the hash here to use the base object.__hash__
instead of Marker.__hash__
I'm letting this run over the weekend on my production Home Assistant so I can examine the cache on Monday once its run for a bit. If all still looks well, I'll mark it ready for review than |
@bdraco Out of curiosity a side-question: What did you do/use to make those graphs? |
They are made using cProfile and than it's converted to a callgrind file and opened in qcachegrind More details at https://www.home-assistant.io/integrations/profiler/ |
Thanks. Looking forward to this one in a production HA |
before

after
