-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Slows down OLAF app start time #14
Comments
It looks like the bulk of time spent is in the I'm using two scripts for this investigation: import sys
from timeit import timeit
from yaml import load, Loader
from oresat_configs import OreSatConfig
def read_configs():
configs = []
for f in sys.argv[1:]:
configs.append(load(f, Loader=Loader))
iterations = 10
duration = timeit(read_configs, number=iterations)
print(duration/iterations)
duration = timeit(lambda: OreSatConfig("0.5"), number=iterations)
print(duration/iterations)
import cProfile
from pstats import Stats
from oresat_configs import OreSatConfig
with cProfile.Profile() as pr:
OreSatConfig("0.5")
pr.create_stats()
Stats(pr).sort_stats("cumtime").print_stats(30) Running
The Running
Because of the overhead of the profiler it is running about twice as slow, but relative timings should be mostly preserved. This shows about 60% of the time is spent in Instead of trying to figure out why
It's about 30% faster, the amount taken up by Looking at the profile output now yaml loading takes up most of the bulk of it. Specifically
Combining both results in an overall reduction by ~85%. |
The next low hanging fruit is that I think With the properly installed
|
The final change I had wanted to try was custom yaml tags (types) to directly go from yaml to the final python type without intermediate conversion. That yielded notable improvements but the downside was non-standard yaml and it was still kinda slow because of the parsing. What if we just didn't do the parsing? At runtime at least. Like |
Yea, we could go the code generation route. That would help a lot. I was thing of caching the ODs as JSONs (where the JSON have all the synchronization/generated stuff from Either way would be a great improvement. |
On a OreSat card, loading in configs for an OreSat mission takes ~14 seconds. This is way too slow, should to be less than 100 milliseconds.
The text was updated successfully, but these errors were encountered: