]> git.ipfire.org Git - thirdparty/asterisk.git/commit
media_index: Improve startup.
authorCorey Farrell <git@cfware.com>
Wed, 6 Dec 2017 18:42:55 +0000 (13:42 -0500)
committerCorey Farrell <git@cfware.com>
Thu, 7 Dec 2017 05:35:53 +0000 (23:35 -0600)
commit289549d6596a10be8e69c81bf71dd7926f06bb8d
tree0ddb8ab50300c29f4ca851504e1a2a3b5b196f86
parent8e6aedbdcde92661ac59ef383cd801f8414e229a
media_index: Improve startup.

This eliminates some wasteful operations in media_index startup.

* Replace statically set string-fields with char[0].
* Eliminate pointless RAII_VAR's.
* alloc_variant: Avoid pointless ao2_find on new info->variant.
* Stop trying find_variant before alloc_variant.
* process_media_file: replace ast_str with ast_asprintf.  This avoids
  reallocation of file_id_str.

Overall sounds_index.c is about 27% of Asterisk startup time when using
sample configs.  This patch reduces it to 20%.  This is a half-fix.  The
real problem is that the media_index is regenerated repeatedly - 68
times in my test.

Change-Id: Ia50b752f8efb356f852b05c4be495a6631af8652
main/media_index.c