Closed profuel closed 2 years ago
Hey profuel,
have a look at #1902, I think this might fix your issue. If you can try it out, I'd be interested if it really does make a difference.
Finally, I have some results. Yes, these changes made the function \Propel\Runtime\ServiceContainer\StandardServiceContainer::initDatabaseMaps almost twice faster - 10ms -> 6ms, I have tested with 352 tables. Still wondering why 6ms are there, but it's better than 10 ms :)
@profuel Can you approve the PR? Then we can merge it. Unless you have an alternative solution at hand?
Interesting finding, @profuel, thank you for testing! We now avoid instantiating the table classes, but they still need to be loaded since we have to access some static properties. My naive guess is that this is the difference between the time we now save and the time it still costs. Though it might also be the time it takes to read the file with the tables from disk. Still, we might be able to further reduce that time by storing the value of those static properties along with the class name in the configuration. Then again, even 0.01s for 300 tables shouldn't make that much of a difference. Is your application really that constraint in regards to execution time?
Hello everyone!
We've noticed that StandardServiceContainer::initDatabaseMaps call takes 10-100 ms and with a regular process execution life cycle, is mostly wasting time. Regular process uses 1-20 tables, but initializing 300+ ones (for our project) makes very low sense. Any ideas why it's implemented like this? Maybe there's a better approach?
Thanks for your thoughts!
Code: https://github.com/propelorm/Propel2/blob/master/src/Propel/Runtime/ServiceContainer/StandardServiceContainer.php#L261