android / android-studio-poet

Large Android projects generator
Apache License 2.0
702 stars 85 forks source link

Cache MethodToCallFromOutside and create blueprints in parallel #49

Closed srmurguia closed 6 years ago

srmurguia commented 6 years ago

The function getMethodToCallForDependency is called on every dependency. This function creates a new ModuleBluePrint to extract methodToCallFromOutside. In a project with N modules there can be upto N*(N-1)/2 dependencies, meaning that the same number of ModuleBluePrint will be generated and deleted.

This change adds a cache to store the values of methodToCallFromOutside, needing now only N ModuleBluePrint.

Also, now the constructor of ProjectBlueprint create moduleBlueprints in parallel.

A project with 1000 modules went from taking around 100 seconds to just 18 (5x imrpovement in time).

NikitaKozlov commented 6 years ago

I'll take a closer look over the weekend, but I think that if we want to measure more stuff we should something less explicit. Something based on AspectJ, for example. I wrote a library once for that, we don't have to use it, but it was very nice that AspectJ helped to hide these measurements. Probably we don't need to do it for this PR, though

NikitaKozlov commented 6 years ago

Please bring master to your branch, we have CI now :)