schmunk42 / yii2-giiant

Yii 2 Framework Code Generator Gii on Steroids
271 stars 120 forks source link

Improved model generation performance #270

Closed rhertogh closed 3 years ago

rhertogh commented 4 years ago

When generating models for many tables (and relations) the generation can take quite some time. The majority of the time is spent on the generateRelations function. Since this function returns the same data for each table this data can be cached.

Test data: 224 tables cacheRelationsData Duration
false 1:00:30
true 0:01:12

In this case the models were generated more than 50x faster with caching enabled.

As far as I can see it is fully backwards compatible. But I've added the modelCacheRelationsData option to disable the cache just in case.

schmunk42 commented 4 years ago

I noticed that our tests were not running correctly (only Scrutinizer). I tried to fix that, but without luck so far... will take a look at it later.

NickvdMeij commented 4 years ago

@schmunk42 any idea when this is going to be merged? Generating all models for my current project takes ages to complete and this improvement does make a major impact (from 60+ seconds to +- 3 seconds to generate all models). What seems to be the problem with the scrutinizer?

schmunk42 commented 4 years ago

Scrutinizer is working, the problem is here https://travis-ci.com/github/schmunk42/yii2-giiant

@eluhr could you try to fix the Travis tests

schmunk42 commented 3 years ago

Thank you!