1# -*- coding: utf-8 -*- 2# ------------------------------------------------------------------------------ 3# Name: timeGraphsImportStar.py 4# Purpose: time how long it takes to import music21, and report biggest offenders 5# 6# Authors: Michael Scott Cuthbert 7# Christopher Ariza 8# 9# Copyright: Copyright © 2009-2020 Michael Scott Cuthbert and the music21 Project 10# License: BSD, see license.txt 11# ------------------------------------------------------------------------------ 12# pragma: no cover 13import cProfile 14import pstats 15 16def main(): 17 with cProfile.Profile() as pr: 18 import music21 19 20 print(f'Profile of {music21.__version__}') 21 stats = pstats.Stats(pr) 22 stats.sort_stats(pstats.SortKey.CUMULATIVE) 23 stats.print_stats('music21', 0.03) 24 25 26if __name__ == '__main__': 27 main() 28