[issue38895] performance degradation creating a mock object (by factor 7-8)

2019-11-25 Thread Marcel Zięba
Marcel Zięba added the comment: "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 optimisatio

[issue38895] performance degradation creating a mock object (by factor 7-8)

2019-11-23 Thread Marcel Zięba
Marcel Zięba added the comment: This is the first commit I've observed slow down: 77b3b7701a34ecf6316469e05b79bb91de2addfa Especially this part looks suspicious https://github.com/python/cpython/commit/77b3b7701a34ecf6316469e05b79bb91de2addfa#diff-ff75b1b83c21770847ade91fa5bb252

[issue38895] performance degradation creating a mock object (by factor 7-8)

2019-11-23 Thread Marcel Zięba
Marcel Zięba added the comment: I've also tested it and can confirm it. Master branch: raw times: 8.43 sec, 7.26 sec, 8.16 sec, 8.4 sec, 7.3