Created
April 5, 2021 11:33
Star
You must be signed in to star a gist
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