Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[factory registerDefinition:] method is slow #325

Closed
warnyul opened this issue Mar 5, 2015 · 11 comments
Closed

[factory registerDefinition:] method is slow #325

warnyul opened this issue Mar 5, 2015 · 11 comments

Comments

@warnyul
Copy link
Contributor

warnyul commented Mar 5, 2015

I has increased the typhoon version in my project to 3.0.1 and the [factory registerDefinition:] will be slower and slower, when the registry array count is increasing. I tried register more than 400 TyphoonDefinitions. The execution time of this method increased to 0.5-0.8 seconds in simulator. Start time of iOS application will be more than 1 minute.

@jasperblues
Copy link
Member

To harzard a guess, it sounds like a full load/unload cycle is happening for each registration.

@jasperblues jasperblues added the bug label Mar 6, 2015
@warnyul
Copy link
Contributor Author

warnyul commented Mar 9, 2015

Probably true. I am debugging the code. In every case after registerDefinition method has been called, it reloads all registered components and calls the [TyphoonFactoryAutoInjectionPostProcessor postProcessDefinitionsInFactory:] method.

alexgarbarev added a commit that referenced this issue Mar 9, 2015
@alexgarbarev
Copy link
Contributor

Please try again with :head version of Typhoon. If everying fine we'll push new release

alexgarbarev added a commit that referenced this issue Mar 10, 2015
@alexgarbarev
Copy link
Contributor

Temproary reverted back, since it's fail tests. Have to do some refactoring on Typhoon Core for that. Hope I'll do that soon (maybe at weekends)

@warnyul
Copy link
Contributor Author

warnyul commented Mar 13, 2015

I have an tip for optimize the code. I removed some cycles from code. The unit test runs correctly and it will be faster. But I can't solve the reload problem and don't understand how solved the circular dependencies this code. I uploaded my changes here.

@jasperblues
Copy link
Member

@alexgarbarev Do you want to review this suggestion?

@warnyul
Copy link
Contributor Author

warnyul commented Mar 18, 2015

I updated my solution. I cached the injected properties for classes. In my case this solution loads components about 4,6-4,8 seconds on iPhone 5.

@jasperblues
Copy link
Member

How about send a pull request, and we can try it out on the main branch for a few days, on current projects. If ok, let's push 3.0.3

@jasperblues
Copy link
Member

Merged to master. Try to find any issues. If all good push 3.0.4

To test:

pod 'Typhoon', :head

@warnyul
Copy link
Contributor Author

warnyul commented Mar 19, 2015

I tested it. It works.

@jasperblues
Copy link
Member

@warnyul Sorry for delay. This is now available at CocoaPods mater repo as Typhoon 3.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants