My program interacts with an API, performs calculations, and builds a Gui using information, some of which is stored in local files (to preserve information between logins). When using cProfile to profile my code, I get the following output:
C:\Users\cheek\Documents\Code\LoL-Performance-Tracker>python -m cProfile -s tottime LoL-Performance-Tracker.py
LoL-Performance-Tracker.py:271: SyntaxWarning: name 'apiKey' is used prior to global declaration
global apiKey
Entered buildMatchHistory
262880 function calls (261634 primitive calls) in 11.867 seconds
Ordered by: internal time
ncalls tottime percall cumtime percall filename:lineno(function)
161 8.684 0.054 8.684 0.054 decoder.py:370(raw_decode)
1 1.100 1.100 1.100 1.100 {question}
1 0.694 0.694 1.794 1.794 {built-in method exec_}
1 0.506 0.506 9.848 9.848 LoL-Performance-Tracker.py:88(buildMatchHistory)
168 0.361 0.002 0.361 0.002 {method 'read' of 'file' objects}
84 0.073 0.001 0.149 0.002 ConfigParser.py:464(_read)
1 0.040 0.040 11.867 11.867 LoL-Performance-Tracker.py:7(<module>)
80 0.035 0.000 9.323 0.117 MatchHistoryBuilder.py:37(buildMatch)
161 0.026 0.000 9.074 0.056 __init__.py:258(load)
251 0.025 0.000 0.025 0.000 {open}
1 0.023 0.023 0.023 0.023 {built-in method show}
23338 0.019 0.000 0.019 0.000 {method 'match' of '_sre.SRE_Pattern' objects}
23176 0.017 0.000 0.017 0.000 collections.py:59(__setitem__)
2 0.016 0.008 0.016 0.008 {built-in method setWidget}
84 0.010 0.000 0.010 0.000 {built-in method setStyleSheet}
11844 0.008 0.000 0.008 0.000 {method 'readline' of 'file' objects}
1 0.006 0.006 11.704 11.704 LoL-Performance-Tracker.py:326(main)
...
The buildMatchHistory method is what I thought would be the problem, because it builds gui objects and is generally pretty cumbersome, but it doesn't seem to be.
I'm using a json encoder/decoder to perform file I/O with a good amount of information. I wouldn't think that it would take multiple seconds to perform these operations, but it looks like it is. Am I correct in my understanding of this output? If not, where should I look instead?
If I'm right, what's a better solution for pulling and storing information between logins?