Re: [pygccxml-development] Another performance tweak
Brought to you by:
mbaas,
roman_yakovenko
From: Roman Y. <rom...@gm...> - 2006-08-26 17:55:35
|
On 8/26/06, Allen Bierbaum <al...@vr...> wrote: > I just found some more tweaks. Cool. I just committed a set of changes that will allow us to keep under control cache results of different algorithms. I still have to write unit tests. These changes allow you to continue grate work. Please take a look on them, what do you think? > - Caching the results of type_traits.remove_alias improved performance > by 20% Yes, this algorithms is used every where. Please don't commit this change, I'd like to think about it. I see next problem here: there are a lot of types, so the cache memory size could go out of control. Can you find out how many memory Py++ takes with\without the cache? > - (danger) Having create_identifier just return the exact same string > passed as full_name improved performance another 20%. > > This last one was interesting because what I found was that (at least in > my project) create_identifier was called about 16,000 times and it > always returned the same value passed in. This could be just because of > how my project works (no namespace aliases that I know of) and is > probably not portable. > > But, one very strange thing is why is this method being called for names > like "boost::python::arg" and "boost::python::default_call_policies"? > As far as I understand how py++ is working, these symbols are always > going to be valid. So why waste the time calling an expensive method if > we already know the outcome? :-) It seems that you missed the point. Py++ has few cool features. mb = module_builder_t( ... ) mb.build_code_creator(...) mb.code_creator.add_namespace_alias( "bpl", "::boost::python" ) or mb.code_creator.add_namespace_usage( "::boost::python" ) See what happens. The short version is that you can add to the code creators tree the namespace usage and aliase and Py++ will generate code that takes into account them. create_identfier function is responsible for creating such identifier. It is safe to add such optimization, but similar work should be done. -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |