asterisk / asterisk

The official Asterisk Project repository.

Home Page:https://www.asterisk.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[improvement]: reduce boot time by ~20% by removing unnecessary xml config queries

zebastian opened this issue · comments

Improvement Description

cachegrind indicates that ~15-20 % of bootup time are spent in ast_xmldoc_query.
In order to do the lookups for certain options always all the loaded documentation xmls are traversed:

AST_LIST_TRAVERSE(&xmldoc_tree, doctree, entry) {
		if (!(results = ast_xml_query(doctree->doc, ast_str_buffer(xpath_str)))) {
			continue;
		}
		break;
	}

An alternative approach would be to store the module name inside the doc_tree on load and only query the xml documents matching the module name on query.
eg instead of:

if (!(results = ast_xmldoc_query("/docs/configInfo[@name='%s']/configFile/configObject[@name='%s']/configOption[@name='%s']", module, object_name, name))) {

do:

if (!(results = ast_xmldoc_query_module(module, "/docs/configInfo[@name='%s']/configFile/configObject[@name='%s']/configOption[@name='%s']", module, object_name, name))) {

Are you going to submit such improvements?

@jcolp yes, i can do that