This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author marseel
Recipients cjw296, julianhille, lisroach, mariocj89, marseel, michael.foord, xtreak
Date 2019-11-25.18:06:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1574705161.0.0.579570617814.issue38895@roundup.psfhosted.org>
In-reply-to
Content
"It seems creating the signature of NonCallableMock.__init__ per mock creation is expensive and since it doesn't change can we just create the signature once and set it as a module level attribute? There might still be room for some more optimisations here to reduce the impact."

This is already done in master branch ;)


"This could be moved to _get_child_mock so that the Mock creation itself for all other mocks and common use case is faster. Creating child mocks will have the iscoroutine function check performed where maybe we can populate the _spec_async list and use it for subsequent calls."

This seems like a reasonable solution.
I've tested it and it improves mock creation speed 2x.

Do you mind if I create PR for it? I would like to start contributing to CPython ;)
History
Date User Action Args
2019-11-25 18:06:01marseelsetrecipients: + marseel, cjw296, michael.foord, lisroach, mariocj89, xtreak, julianhille
2019-11-25 18:06:01marseelsetmessageid: <1574705161.0.0.579570617814.issue38895@roundup.psfhosted.org>
2019-11-25 18:06:00marseellinkissue38895 messages
2019-11-25 18:06:00marseelcreate