-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from gituser12981u2/optimization
ran a profile
- Loading branch information
Showing
4 changed files
with
25 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,9 @@ coverage.xml | |
.hypothesis/ | ||
debug.log | ||
|
||
# Performance profile | ||
init_profile.profile | ||
|
||
# PyCharm | ||
.idea/ | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import pstats | ||
import sys | ||
|
||
|
||
def analyze_profile(profile_file): | ||
# Create a Stats object from the profile file | ||
stats = pstats.Stats(profile_file) | ||
|
||
# Sort the statistics by the cumulative time spent in the function | ||
stats.sort_stats('cumulative') | ||
|
||
# Print the ten functions that took the most cumulative time | ||
stats.print_stats(10) | ||
|
||
|
||
if __name__ == "__main__": | ||
if len(sys.argv) < 2: | ||
print("Usage: python analyze_profile.py profile_file") | ||
else: | ||
analyze_profile(sys.argv[1]) |
Empty file.
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