ros-drivers / audio_common

Common code for working with audio in ROS
BSD 3-Clause "New" or "Revised" License
86 stars 151 forks source link

Importing the sound_play module is slow #228

Closed furushchev closed 1 year ago

furushchev commented 1 year ago

Loading this module is slow especially on a machine with slow disk i/o. I briefly profiled importing this library and found that the most of time is consumed on the initialization of the FlitePlugin class. https://github.com/ros-drivers/audio_common/blob/master/sound_play/src/sound_play/flite_plugin.py#L17-L20 And as the class is initialized on the toplevel ( __init__.py ), this affects importing any class in this module. https://github.com/ros-drivers/audio_common/blob/master/sound_play/src/sound_play/__init__.py#L34

Screenshot 2023-04-10 at 2 25 38 PM
knorth55 commented 1 year ago

@furushchev Thank you! The problem is that rospack is super slow for initialization.

As app_manager, we can share rospack object and make the package faster. https://github.com/PR2/app_manager/pull/52