def init_optimizer(self):
if self.name == '<STR_LIT>':<EOL><INDENT>self._logger.debug(<EOL>"<STR_LIT>")<EOL><DEDENT>start_time = timeit.default_timer()<EOL>self.clear_optimizer()<EOL>for dtype in scopedef_t._impl_all_decl_types:<EOL><INDENT>self._type2decls[dtype] = []<EOL>self._type2decls_nr[dtype] = []<EOL>self._type2name2decls[dtype] = {}<EOL>self._type2name2decls_nr[dtype] = {}<EOL><DEDENT>self._all_decls_not_recursive = self.declarations<EOL>self._all_decls = make_flatten(<EOL>self._all_decls_not_recursive)<EOL>for decl in self._all_decls:<EOL><INDENT>types = self.__decl_types(decl)<EOL>for type_ in types:<EOL><INDENT>self._type2decls[type_].append(decl)<EOL>name2decls = self._type2name2decls[type_]<EOL>if decl.name not in name2decls:<EOL><INDENT>name2decls[decl.name] = []<EOL><DEDENT>name2decls[decl.name].append(decl)<EOL>if self is decl.parent:<EOL><INDENT>self._type2decls_nr[type_].append(decl)<EOL>name2decls_nr = self._type2name2decls_nr[type_]<EOL>if decl.name not in name2decls_nr:<EOL><INDENT>name2decls_nr[decl.name] = []<EOL><DEDENT>name2decls_nr[decl.name].append(decl)<EOL><DEDENT><DEDENT><DEDENT>for decl in self._all_decls_not_recursive:<EOL><INDENT>if isinstance(decl, scopedef_t):<EOL><INDENT>decl.init_optimizer()<EOL><DEDENT><DEDENT>if self.name == '<STR_LIT>':<EOL><INDENT>self._logger.debug((<EOL>"<STR_LIT>" +<EOL>"<STR_LIT>"), (timeit.default_timer() - start_time))<EOL><DEDENT>self._optimized = True<EOL>
Initializes query optimizer state.

There are 4 internals hash tables:
    1. from type to declarations
    2. from type to declarations for non-recursive queries
    3. from type to name to declarations
    4. from type to name to declarations for non-recursive queries

Almost every query includes declaration type information. Also very
common query is to search some declaration(s) by name or full name.
Those hash tables allows to search declaration very quick.