Created
April 5, 2021 11:33
-
-
Save bilalozdemir/8f6de7e66be66bf642afe98d24d60055 to your computer and use it in GitHub Desktop.
How to Profile a Python Program - Block 5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Filename: example_2.py | |
Line # Mem usage Increment Occurences Line Contents | |
============================================================ | |
3 18.6 MiB 18.6 MiB 1 @profile | |
4 def wasteful_sum_function() -> int: | |
5 19.1 MiB 0.5 MiB 10003 return sum([x**2 for x in range(10**4)]) | |
Filename: example_2.py | |
Line # Mem usage Increment Occurences Line Contents | |
============================================================ | |
7 19.1 MiB 19.1 MiB 1 @profile | |
8 def resource_efficient_sum_function() -> int: | |
9 19.1 MiB 0.0 MiB 20003 return sum((x**2 for x in range(10**4))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment