Skip to content

Commit

Permalink
Speed up mock_constructor by removing gc.collect (#335)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #335

mock_aiog
0:00:00.064367
from this calling gc.collect took:
0:00:00.053297 and it's _synchronous_

since default slow callback detection is 0.1 if someone uses multiple mock_constructor calls these gc.collect-s add up and exceed the threshold

Reviewed By: doranand

Differential Revision: D38073077

fbshipit-source-id: fb1a80905211b058f674c98333075f40e9efcbf3
  • Loading branch information
deathowl authored and facebook-github-bot committed Jul 22, 2022
1 parent f52efb1 commit 3d97b70
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion testslide/mock_constructor.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,6 @@ def mock_constructor(
"Usage with classes that define __new__() is currently not supported."
)

gc.collect()
instances = [
obj
for obj in gc.get_referrers(original_class)
Expand Down

0 comments on commit 3d97b70

Please sign in to comment.