Thanks to visit codestin.com
Credit goes to github.com

Skip to content

font_manager.py takes multiple seconds to import #4756

Closed
@ssanderson

Description

@ssanderson

This is brutal amount of latency when trying to provide a smooth user experience from an application that uses matplotlib internally.

In [1]: %prun -r -s cumtime -l 20 import matplotlib.pyplot

ncalls  tottime  percall  cumtime  percall filename:lineno(function)
        1    0.002    0.002    2.461    2.461 <string>:1(<module>)
        1    0.001    0.001    2.413    2.413 pyplot.py:17(<module>)
        1    0.001    0.001    2.392    2.392 colorbar.py:20(<module>)
        1    0.001    0.001    2.380    2.380 collections.py:10(<module>)
        1    0.002    0.002    2.374    2.374 backend_bases.py:28(<module>)
        1    0.001    0.001    2.365    2.365 textpath.py:3(<module>)
        1    0.001    0.001    2.362    2.362 font_manager.py:21(<module>)
        1    0.000    0.000    2.361    2.361 font_manager.py:952(pickle_load)
        1    0.003    0.003    2.361    2.361 {cPickle.load}
        1    0.001    0.001    2.358    2.358 font_manager.py:1013(__init__)
        2    0.098    0.049    2.275    1.137 font_manager.py:544(createFontList)
      215    0.000    0.000    2.149    0.010 afm.py:341(__init__)
      215    0.001    0.000    2.148    0.010 afm.py:323(parse_afm)
      215    0.001    0.000    1.443    0.007 afm.py:292(_parse_optional)
      182    0.979    0.005    1.434    0.008 afm.py:220(_parse_kern_pairs)
      215    0.374    0.002    0.690    0.003 afm.py:180(_parse_char_metrics)
  1298020    0.229    0.000    0.229    0.000 {method 'split' of 'str' objects}
   839978    0.157    0.000    0.157    0.000 {method 'readline' of 'file' objects}
   114276    0.087    0.000    0.107    0.000 afm.py:72(_to_list_of_floats)
   843180    0.092    0.000    0.092    0.000 {method 'startswith' of 'str' objects}
        4    0.000    0.000    0.082    0.021 font_manager.py:294(findSystemFonts)q

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions