def createModuleTree(module, source_ref, source_filename, is_main): if Options.isShowProgress(): memory_watch = Utils.MemoryWatch() source_code = readSourceCodeFromFilename(source_filename) module_body = buildParseTree( provider = module, source_code = source_code, source_ref = source_ref, is_module = True, is_main = is_main ) module.setBody( module_body ) completeVariableClosures(module) if Options.isShowProgress(): memory_watch.finish() Tracing.printLine( "Memory usage changed loading module '%s': %s" % ( module.getFullName(), memory_watch.asStr() ) )
def optimizePythonModule(module): if _progress: printLine( "Doing module local optimizations for '{module_name}'.".format( module_name=module.getFullName())) # The tag set is global, so it can react to changes without context. # pylint: disable=W0603 global tag_set tag_set = TagSet() touched = False if _progress: memory_watch = Utils.MemoryWatch() while True: tag_set.clear() _optimizeModulePass(module=module) if not tag_set: break touched = True if _progress: memory_watch.finish() printLine("Memory usage changed during optimization of '%s': %s" % (module.getFullName(), memory_watch.asStr())) return touched
def optimizePythonModule(module): if _progress: printLine( "Doing module local optimizations for '{module_name}'.".format( module_name=module.getFullName())) global tag_set tag_set = TagSet() touched = False if _progress: memory_watch = Utils.MemoryWatch() while True: tag_set.clear() _optimizeModulePass(module=module, tag_set=tag_set) if not tag_set: break touched = True if _progress: memory_watch.finish() printLine("Memory usage changed during optimization of '%s': %s" % (module.getFullName(), memory_watch.asStr())) return touched