[pygccxml-commit] SF.net SVN: pygccxml: [1011] pygccxml_dev
Brought to you by:
mbaas,
roman_yakovenko
From: <rom...@us...> - 2007-04-20 20:22:26
|
Revision: 1011 http://svn.sourceforge.net/pygccxml/?rev=1011&view=rev Author: roman_yakovenko Date: 2007-04-20 13:22:23 -0700 (Fri, 20 Apr 2007) Log Message: ----------- adding another set of performance optimizations, basically to reduce the number of "make_flatten" calls Modified Paths: -------------- pygccxml_dev/pygccxml/parser/patcher.py pygccxml_dev/pygccxml/parser/scanner.py pygccxml_dev/pygccxml/parser/source_reader.py pygccxml_dev/unittests/patcher_tester.py pygccxml_dev/unittests/test_performance.py Added Paths: ----------- pygccxml_dev/docs/links.rest pygccxml_dev/unittests/results.txt Added: pygccxml_dev/docs/links.rest =================================================================== --- pygccxml_dev/docs/links.rest (rev 0) +++ pygccxml_dev/docs/links.rest 2007-04-20 20:22:23 UTC (rev 1011) @@ -0,0 +1,31 @@ +============== +C++ Reflection +============== + +.. contents:: Table of contents + +----- +Links +----- + +* `CppReflect`_ - extracts reflection information from executables, which were + build with debug information. It works with executables that has COFF or ELF + format. + +.. _`CppReflect` : http://www.garret.ru/~knizhnik/cppreflection/docs/reflect.html + +* `XTI An Extended Type Information Library`_ - Bjarne Stroustrup talk about adding + reflection information to C++ program. + + + +.. _`XTI An Extended Type Information Library` : http://lcgapp.cern.ch/project/architecture/XTI_accu.pdf + +.. _`pygccxml`: ./pygccxml.html +.. + Local Variables: + mode: indented-text + indent-tabs-mode: nil + sentence-end-double-space: t + fill-column: 70 + End: Modified: pygccxml_dev/pygccxml/parser/patcher.py =================================================================== --- pygccxml_dev/pygccxml/parser/patcher.py 2007-04-20 14:58:08 UTC (rev 1010) +++ pygccxml_dev/pygccxml/parser/patcher.py 2007-04-20 20:22:23 UTC (rev 1011) @@ -8,8 +8,9 @@ class default_argument_patcher_t( object ): - def __init__( self ): + def __init__( self, enums ): object.__init__( self ) + self.__enums = enums def __call__(self, decl): for arg in decl.arguments: @@ -102,10 +103,10 @@ #this algorithm could be improved: it could take into account #1. unnamed namespaced #2. location within files - enumeration_t = declarations.enumeration_t - for decl in scope.declarations: - if isinstance( decl, enumeration_t ) and decl.has_value_name( default_value ): - return decl + + for enum in self.__enums: + if enum.parent is scope and enum.has_value_name( default_value ): + return enum return None def __is_double_call( self, func, arg ): @@ -174,14 +175,14 @@ def __call__(self, decl): decl.name = 'operator ' + decl.return_type.decl_string -_default_arg_patcher_ = default_argument_patcher_t() _casting_oper_patcher_ = casting_operator_patcher_t() -def fix_decls(decls): +def fix_decls(decls, enums): + default_arg_patcher = default_argument_patcher_t(enums) #decls should be flat list of all declarations, you want to apply patch on for decl in decls: if isinstance( decl, declarations.calldef_t ): - _default_arg_patcher_( decl ) + default_arg_patcher( decl ) if isinstance( decl, declarations.casting_operator_t): _casting_oper_patcher_( decl ) Modified: pygccxml_dev/pygccxml/parser/scanner.py =================================================================== --- pygccxml_dev/pygccxml/parser/scanner.py 2007-04-20 14:58:08 UTC (rev 1010) +++ pygccxml_dev/pygccxml/parser/scanner.py 2007-04-20 20:22:23 UTC (rev 1011) @@ -126,6 +126,10 @@ #mapping from id -> decl self.__declarations = {} + #list of all read declarations + self.__all_declarations = [] + #list of enums I need later + self.__enums = [] #mapping from id -> type self.__types = {} #mapping from id -> file @@ -153,6 +157,12 @@ def declarations(self): return self.__declarations + def all_declarations( self ): + return self.__all_declarations + + def enums(self): + return self.__enums + def types(self): return self.__types @@ -184,6 +194,7 @@ self.__read_access( attrs ) element_id = attrs.get(XML_AN_ID, None) if isinstance( obj, declaration_t ): + self.__all_declarations.append( obj ) self.__update_membership( attrs ) self.__declarations[ element_id ] = obj if not isinstance( obj, namespace_t ): @@ -211,7 +222,7 @@ self.__inst = None def __read_location(self, decl, attrs): - decl.location = location_t( file_name=attrs[XML_AN_FILE], line=int( attrs[XML_AN_LINE])) + decl.location = location_t( file_name=attrs[XML_AN_FILE], line=int(attrs[XML_AN_LINE])) def __update_membership(self, attrs): parent = attrs.get( XML_AN_CONTEXT, None ) @@ -259,7 +270,9 @@ if '$_' in enum_name or '._' in enum_name: #it means that this is unnamed enum. in c++ enum{ x }; enum_name = '' - return self.__decl_factory.create_enumeration( name=enum_name ) + decl = self.__decl_factory.create_enumeration( name=enum_name ) + self.__enums.append( decl ) + return decl def __read_enumeration_value( self, attrs ): name = attrs.get( XML_AN_NAME, '' ) Modified: pygccxml_dev/pygccxml/parser/source_reader.py =================================================================== --- pygccxml_dev/pygccxml/parser/source_reader.py 2007-04-20 14:58:08 UTC (rev 1010) +++ pygccxml_dev/pygccxml/parser/source_reader.py 2007-04-20 20:22:23 UTC (rev 1011) @@ -337,9 +337,9 @@ #it happens for example in next situation #template< typename X> #void ddd(){ typedef typename X::Y YY;} - decls = filter( lambda inst: isinstance(inst, declaration_t) and not inst.parent - , decls.itervalues() ) - patcher.fix_decls( make_flatten( decls ) ) - decls = filter( lambda inst: isinstance( inst, namespace_t ), decls ) + #if I will fail on this bug next time, the right way to fix it may be different + patcher.fix_decls( scanner_.all_declarations(), scanner_.enums() ) + decls = filter( lambda inst: isinstance( inst, namespace_t ) and not inst.parent + , decls.itervalues() ) return ( decls, files.values() ) Modified: pygccxml_dev/unittests/patcher_tester.py =================================================================== --- pygccxml_dev/unittests/patcher_tester.py 2007-04-20 14:58:08 UTC (rev 1010) +++ pygccxml_dev/unittests/patcher_tester.py 2007-04-20 20:22:23 UTC (rev 1011) @@ -60,8 +60,11 @@ self.failUnless( typedef__func.arguments[0].default_value == u"::typedef_::alias( )" ) if 32 == self.architecture: clone_tree = self.global_ns.free_fun( 'clone_tree' ) - default_value = 'vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >,std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >()' - self.failUnless( default_value == clone_tree.arguments[0].default_value ) + default_values = [ + 'vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >,std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >()' + , 'vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >,std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >((&allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >()))' + ] + self.failUnless( clone_tree.arguments[0].default_value in default_values) class tester_32_t( tester_impl_t ): def __init__(self, *args): Added: pygccxml_dev/unittests/results.txt =================================================================== --- pygccxml_dev/unittests/results.txt (rev 0) +++ pygccxml_dev/unittests/results.txt 2007-04-20 20:22:23 UTC (rev 1011) @@ -0,0 +1,242 @@ +>python -u "test_performance.py" +unittests will run on DEVELOPMENT version +running + +INFO Parsing xml file "/home/roman/language-binding/sources/pygccxml_dev/unittests/data/big.xml" ... + 15815730 function calls (15569178 primitive calls) in 102.347 CPU seconds + + Ordered by: internal time, call count + List reduced from 424 to 20 due to restriction <20> + + ncalls tottime percall cumtime percall filename:lineno(function) + 1324 8.493 0.006 16.359 0.012 ../pygccxml/parser/patcher.py:115(__find_enum) + 3188314 7.700 0.000 7.700 0.000 ../pygccxml/parser/patcher.py:119(<lambda>) + 735216 7.090 0.000 7.090 0.000 posixpath.py:56(join) + 582283 6.519 0.000 6.894 0.000 posixpath.py:156(islink) + 76466 5.295 0.000 21.655 0.000 posixpath.py:410(realpath) + 271521 3.945 0.000 3.945 0.000 <string>:55(__iter__) + 135760 2.234 0.000 19.078 0.000 ../pygccxml/parser/scanner.py:174(startElement) + 141610 2.018 0.000 2.441 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/cpptypes.py:14(__init__) + 38689 1.917 0.000 4.648 0.000 ../pygccxml/parser/scanner.py:344(__read_member_function) + 1 1.784 1.784 88.092 88.092 ../pygccxml/parser/source_reader.py:315(__parse_gccxml_created_file) + 76466 1.624 0.000 25.001 0.000 ../pygccxml/parser/source_reader.py:304(__produce_full_file) + 76466 1.616 0.000 1.616 0.000 posixpath.py:373(normpath) + 1 1.594 1.594 24.988 24.988 ../pygccxml/parser/etree_scanner.py:45(read) +225592/69633 1.582 0.000 1.835 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/project_reader.py:453(get_from_type) +141499/141100 1.510 0.000 2.789 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithm.py:10(declaration_path) + 27828/6 1.490 0.000 2.173 0.362 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithm.py:71(proceed_single) + 41683 1.463 0.000 2.122 0.000 ../pygccxml/parser/scanner.py:315(__read_argument) + 76194 1.449 0.000 1.795 0.000 ../pygccxml/parser/scanner.py:215(__read_location) + 90232 1.300 0.000 1.981 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/linker.py:24(_set_inst) + 1 1.218 1.218 4.453 4.453 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/project_reader.py:424(_relink_declarated_types) + + +running - done +>Exit code: 0 + + + + + +INFO Parsing xml file "/home/roman/language-binding/sources/pygccxml_dev/unittests/data/big.xml" ... + 12627416 function calls (12380864 primitive calls) in 77.817 CPU seconds + + Ordered by: internal time, call count + List reduced from 423 to 20 due to restriction <20> + + ncalls tottime percall cumtime percall filename:lineno(function) + 735216 6.205 0.000 6.205 0.000 posixpath.py:56(join) + 582283 5.645 0.000 6.005 0.000 posixpath.py:156(islink) + 76466 4.705 0.000 19.188 0.000 posixpath.py:410(realpath) + 271521 3.354 0.000 3.354 0.000 <string>:55(__iter__) + 1324 2.394 0.002 2.534 0.002 ../pygccxml/parser/patcher.py:115(__find_enum) + 135760 1.929 0.000 15.088 0.000 ../pygccxml/parser/scanner.py:174(startElement) + 1 1.704 1.704 63.984 63.984 ../pygccxml/parser/source_reader.py:315(__parse_gccxml_created_file) +225592/69633 1.590 0.000 1.846 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/project_reader.py:453(get_from_type) +141499/141100 1.498 0.000 2.742 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithm.py:10(declaration_path) + 76466 1.486 0.000 1.486 0.000 posixpath.py:373(normpath) + 1 1.451 1.451 20.204 20.204 ../pygccxml/parser/etree_scanner.py:45(read) + 90232 1.219 0.000 1.869 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/linker.py:24(_set_inst) + 76466 1.195 0.000 21.955 0.000 ../pygccxml/parser/source_reader.py:304(__produce_full_file) + 41683 1.062 0.000 1.892 0.000 ../pygccxml/parser/scanner.py:312(__read_argument) + 76205 1.053 0.000 1.855 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/declaration.py:60(__init__) + 65791 1.047 0.000 3.838 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/class_declaration.py:282(adopt_declaration) + 41652 0.981 0.000 1.682 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/linker.py:61(__link_calldef) + 76466 0.957 0.000 0.957 0.000 posixpath.py:168(exists) + 27828/6 0.954 0.000 1.592 0.265 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithm.py:71(proceed_single) + 557669 0.936 0.000 0.936 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/declaration.py:185(_get_location) + + +running - done +>Exit code: 0 + +>python -u "test_performance.py" +unittests will run on DEVELOPMENT version +running + +INFO Parsing xml file "/home/roman/language-binding/sources/pygccxml_dev/unittests/data/big.xml" ... + 10073090 function calls (9835812 primitive calls) in 58.827 CPU seconds + + Ordered by: internal time, call count + List reduced from 419 to 20 due to restriction <20> + + ncalls tottime percall cumtime percall filename:lineno(function) + 271521 3.735 0.000 3.735 0.000 <string>:55(__iter__) + 1324 2.521 0.002 2.667 0.002 ../pygccxml/parser/patcher.py:101(__find_enum) +225592/69633 2.357 0.000 2.613 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/project_reader.py:453(get_from_type) + 135760 2.218 0.000 16.325 0.000 ../pygccxml/parser/scanner.py:174(startElement) + 141610 1.943 0.000 2.325 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/cpptypes.py:14(__init__) + 76194 1.807 0.000 2.137 0.000 ../pygccxml/parser/scanner.py:213(__read_location) + 1 1.531 1.531 21.903 21.903 ../pygccxml/parser/etree_scanner.py:45(read) +141499/141100 1.527 0.000 2.830 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithm.py:10(declaration_path) + 1 1.457 1.457 4.782 4.782 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/project_reader.py:424(_relink_declarated_types) + 90232 1.205 0.000 1.866 0.000 ../pygccxml/parser/linker.py:24(_set_inst) + 41683 1.123 0.000 1.737 0.000 ../pygccxml/parser/scanner.py:313(__read_argument) + 65791 1.075 0.000 4.162 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/class_declaration.py:282(adopt_declaration) + 41652 1.012 0.000 1.727 0.000 ../pygccxml/parser/linker.py:61(__link_calldef) + 38526 0.941 0.000 2.268 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/calldef.py:371(function_type) + 76205 0.908 0.000 1.459 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/declaration.py:60(__init__) + 518982 0.861 0.000 0.861 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/declaration.py:230(cache) + 76204 0.782 0.000 2.501 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithms_cache.py:70(reset) + 41652 0.728 0.000 2.552 0.000 ../pygccxml/parser/scanner.py:325(__read_calldef) + 516848 0.711 0.000 0.711 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithms_cache.py:26(enabled) + 71642 0.678 0.000 2.597 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/project_reader.py:425(<lambda>) + + +running - done +>Exit code: 0 + +>python -u "test_performance.py" +unittests will run on DEVELOPMENT version +running + +INFO Parsing xml file "/home/roman/language-binding/sources/pygccxml_dev/unittests/data/big.xml" ... + 10583171 function calls (10350530 primitive calls) in 60.270 CPU seconds + + Ordered by: internal time, call count + List reduced from 421 to 20 due to restriction <20> + + ncalls tottime percall cumtime percall filename:lineno(function) + 271521 3.893 0.000 3.893 0.000 <string>:55(__iter__) + 135760 2.191 0.000 16.832 0.000 ../pygccxml/parser/scanner.py:179(startElement) + 141610 2.124 0.000 2.545 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/cpptypes.py:14(__init__) +225592/69633 1.774 0.000 2.064 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/project_reader.py:453(get_from_type) + 1 1.607 1.607 22.649 22.649 ../pygccxml/parser/etree_scanner.py:45(read) +141499/141100 1.567 0.000 3.062 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithm.py:10(declaration_path) + 76194 1.555 0.000 1.908 0.000 ../pygccxml/parser/scanner.py:219(__read_location) + 1324 1.546 0.001 2.569 0.002 ../pygccxml/parser/patcher.py:102(__find_enum) + 41683 1.308 0.000 1.938 0.000 ../pygccxml/parser/scanner.py:319(__read_argument) + 90232 1.197 0.000 1.899 0.000 ../pygccxml/parser/linker.py:24(_set_inst) + 1 1.178 1.178 4.614 4.614 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/project_reader.py:424(_relink_declarated_types) + 65791 1.113 0.000 4.126 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/class_declaration.py:282(adopt_declaration) + 76205 1.084 0.000 1.084 0.000 ../pygccxml/parser/patcher.py:182(<lambda>) + 608538 1.006 0.000 1.006 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/declaration.py:160(_get_parent) + 41652 1.000 0.000 1.761 0.000 ../pygccxml/parser/linker.py:61(__link_calldef) + 76205 0.975 0.000 1.488 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/declaration.py:60(__init__) + 518982 0.934 0.000 0.934 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/declaration.py:230(cache) + 516848 0.910 0.000 0.910 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithms_cache.py:26(enabled) + 76204 0.818 0.000 2.456 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithms_cache.py:70(reset) + 38526 0.812 0.000 2.163 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/calldef.py:371(function_type) + + +running - done +>Exit code: 0 + + +>python -u "test_performance.py" +unittests will run on DEVELOPMENT version +running + +INFO Parsing xml file "/home/roman/language-binding/sources/pygccxml_dev/unittests/data/big.xml" ... +INFO Parsing xml file "/home/roman/language-binding/sources/pygccxml_dev/unittests/data/big.xml" ... +INFO Parsing xml file "/home/roman/language-binding/sources/pygccxml_dev/unittests/data/big.xml" ... + 31749399 function calls (31051476 primitive calls) in 188.225 CPU seconds + + Ordered by: internal time, call count + List reduced from 421 to 30 due to restriction <30> + + ncalls tottime percall cumtime percall filename:lineno(function) + 814563 12.143 0.000 12.143 0.000 <string>:55(__iter__) + 424830 7.973 0.000 9.177 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/cpptypes.py:14(__init__) + 407280 7.053 0.000 56.374 0.000 ../pygccxml/parser/scanner.py:179(startElement) +676776/208899 5.302 0.000 6.200 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/project_reader.py:453(get_from_type) + 3 5.219 1.740 74.732 24.911 ../pygccxml/parser/etree_scanner.py:45(read) +424497/423300 5.084 0.000 9.270 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithm.py:10(declaration_path) + 125049 4.247 0.000 6.629 0.000 ../pygccxml/parser/scanner.py:319(__read_argument) + 3972 4.153 0.001 7.367 0.002 ../pygccxml/parser/patcher.py:102(__find_enum) + 228615 4.025 0.000 5.306 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/declaration.py:60(__init__) + 124956 4.000 0.000 6.375 0.000 ../pygccxml/parser/linker.py:61(__link_calldef) + 270696 3.940 0.000 6.193 0.000 ../pygccxml/parser/linker.py:24(_set_inst) + 197373 3.522 0.000 13.509 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/class_declaration.py:282(adopt_declaration) + 228582 3.355 0.000 4.619 0.000 ../pygccxml/parser/scanner.py:219(__read_location) + 1825614 3.128 0.000 3.128 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/declaration.py:160(_get_parent) + 3 3.087 1.029 14.448 4.816 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/project_reader.py:424(_relink_declarated_types) + 228612 2.998 0.000 8.169 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithms_cache.py:70(reset) + 1550544 2.991 0.000 2.991 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithms_cache.py:26(enabled) + 1556946 2.905 0.000 2.905 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/declaration.py:230(cache) + 115578 2.626 0.000 6.350 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/calldef.py:371(function_type) + 124956 2.494 0.000 8.618 0.000 ../pygccxml/parser/scanner.py:331(__read_calldef) + 214926 2.125 0.000 8.512 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/project_reader.py:425(<lambda>) + 6 1.954 0.326 9.310 1.552 ../pygccxml/parser/source_reader.py:27(bind_aliases) + 987228 1.940 0.000 1.940 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/declaration.py:185(_get_location) + 3 1.873 0.624 138.282 46.094 ../pygccxml/parser/source_reader.py:315(__parse_gccxml_created_file) + 3 1.761 0.587 15.909 5.303 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/project_reader.py:452(__declarated_types) + 270696 1.729 0.000 29.906 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithm.py:265(apply_visitor) + 425985 1.719 0.000 2.409 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithms_cache.py:43(_set_access_type) + 116067 1.701 0.000 10.146 0.000 ../pygccxml/parser/scanner.py:348(__read_member_function) + 13914 1.696 0.000 16.956 0.001 ../pygccxml/parser/linker.py:46(__link_members) + 41742/9 1.642 0.000 2.707 0.301 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithm.py:71(proceed_single) + + +running - done +>Exit code: 0 + +>python -u "test_performance.py" +unittests will run on DEVELOPMENT version +running + +INFO Parsing xml file "/home/roman/language-binding/sources/pygccxml_dev/unittests/data/big.xml" ... + +INFO Parsing xml file "/home/roman/language-binding/sources/pygccxml_dev/unittests/data/big.xml" ... + +INFO Parsing xml file "/home/roman/language-binding/sources/pygccxml_dev/unittests/data/big.xml" ... + 31520787 function calls (30822864 primitive calls) in 199.769 CPU seconds + + Ordered by: internal time, call count + List reduced from 421 to 30 due to restriction <30> + + ncalls tottime percall cumtime percall filename:lineno(function) + 814563 12.595 0.000 12.595 0.000 <string>:55(__iter__) + 424830 8.190 0.000 9.620 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/cpptypes.py:14(__init__) + 407280 6.869 0.000 57.260 0.000 ../pygccxml/parser/scanner.py:184(startElement) +424497/423300 5.643 0.000 10.489 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithm.py:10(declaration_path) +676776/208899 5.519 0.000 6.542 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/project_reader.py:453(get_from_type) + 3 5.488 1.829 76.478 25.493 ../pygccxml/parser/etree_scanner.py:45(read) + 3972 4.797 0.001 8.675 0.002 ../pygccxml/parser/patcher.py:102(__find_enum) + 125049 4.328 0.000 6.655 0.000 ../pygccxml/parser/scanner.py:326(__read_argument) + 228615 4.253 0.000 5.794 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/declaration.py:60(__init__) + 124956 4.168 0.000 6.604 0.000 ../pygccxml/parser/linker.py:61(__link_calldef) + 270696 3.926 0.000 6.478 0.000 ../pygccxml/parser/linker.py:24(_set_inst) + 1825614 3.770 0.000 3.770 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/declaration.py:160(_get_parent) + 197373 3.757 0.000 13.898 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/class_declaration.py:282(adopt_declaration) + 228582 3.485 0.000 4.765 0.000 ../pygccxml/parser/scanner.py:224(__read_location) + 1556946 3.162 0.000 3.162 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/declaration.py:230(cache) + 3 3.091 1.030 14.798 4.933 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/project_reader.py:424(_relink_declarated_types) + 115578 3.047 0.000 7.004 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/calldef.py:371(function_type) + 228612 2.726 0.000 8.139 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithms_cache.py:70(reset) + 1550544 2.720 0.000 2.720 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithms_cache.py:26(enabled) + 124956 2.413 0.000 8.018 0.000 ../pygccxml/parser/scanner.py:338(__read_calldef) + 6 2.260 0.377 10.256 1.709 ../pygccxml/parser/source_reader.py:27(bind_aliases) + 214926 2.179 0.000 8.457 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/project_reader.py:425(<lambda>) + 987228 2.063 0.000 2.063 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/declaration.py:185(_get_location) + 3 1.956 0.652 145.544 48.515 ../pygccxml/parser/source_reader.py:315(__parse_gccxml_created_file) + 116067 1.946 0.000 10.222 0.000 ../pygccxml/parser/scanner.py:355(__read_member_function) + 3 1.928 0.643 17.163 5.721 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/parser/project_reader.py:452(__declarated_types) + 13914 1.902 0.000 17.540 0.001 ../pygccxml/parser/linker.py:46(__link_members) + 425985 1.879 0.000 2.584 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithms_cache.py:43(_set_access_type) + 270696 1.799 0.000 30.748 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/algorithm.py:265(apply_visitor) + 547467 1.679 0.000 1.679 0.000 /home/roman/language-binding/sources/pygccxml_dev/pygccxml/declarations/cpptypes.py:581(_get_declaration) + + +running - done +>Exit code: 0 Modified: pygccxml_dev/unittests/test_performance.py =================================================================== --- pygccxml_dev/unittests/test_performance.py 2007-04-20 14:58:08 UTC (rev 1010) +++ pygccxml_dev/unittests/test_performance.py 2007-04-20 20:22:23 UTC (rev 1011) @@ -6,8 +6,8 @@ import os import sys import time -import pstats -import cProfile +import hotshot +import hotshot.stats import autoconfig from pygccxml import * @@ -85,8 +85,9 @@ def parse_big_file(): reader = parser.project_reader_t( parser.config_t(gccxml_path=autoconfig.gccxml_path) ) - reader.read_files([parser.create_gccxml_fc( os.path.join( autoconfig.data_directory, 'big.xml' ) )]) + reader.read_files([parser.create_gccxml_fc( os.path.join( autoconfig.data_directory, 'big.xml' ) )]) + reader.read_files([parser.create_gccxml_fc( os.path.join( autoconfig.data_directory, 'big.xml' ) )]) if __name__ == "__main__": @@ -95,15 +96,19 @@ #~ test_source_on_include_std_dot_hpp() #~ test_project_on_include_std_dot_hpp() print 'running' - cProfile.run('parse_big_file()', 'pygccxml.profile') + prof = hotshot.Profile( 'parser.prof' ) + prof.runcall(parse_big_file ) + stats = hotshot.stats.load("parser.prof") + stats.sort_stats('time', 'calls') + stats.print_stats(30) print 'running - done' - print 'loading file' - pdata = pstats.Stats('pygccxml.profile') - print 'loading file - done' - print 'striping dirs' - pdata.strip_dirs() - print 'striping dirs - done' - print 'sorting stats' - pdata.sort_stats('cumulative', 'time').print_stats(476) - print 'sorting stats - done' + #~ print 'loading file' + #~ pdata = pstats.Stats('pygccxml.profile') + #~ print 'loading file - done' + #~ print 'striping dirs' + #~ pdata.strip_dirs() + #~ print 'striping dirs - done' + #~ print 'sorting stats' + #~ pdata.sort_stats('time').print_stats(476) + #~ print 'sorting stats - done' #pdata.print_callers('find_all_declarations') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |