Skip to content
This repository has been archived by the owner on Dec 5, 2019. It is now read-only.

How about improve concrete protocol macro? #144

Open
JianboYan opened this issue Mar 18, 2019 · 0 comments
Open

How about improve concrete protocol macro? #144

JianboYan opened this issue Mar 18, 2019 · 0 comments

Comments

@JianboYan
Copy link

Hi there, thanks for this fantastic lib, it's very useful and the code is very impressive. I really want to put concrete protocol into my project, however, I found some performance issue(this lib looks like not maintained, but why don't we just discuss this issue here).

I checked the implementation of the concrete protocol function, and I found when loading concrete protocols, a lot of time will spent on traversing all Objc classes for making protocol connected target class automatically. I have a test in an almost empty project, and we will got more than 13000 classes in the system foundation. it will take very long time to load all the concrete protocols.

In this simple test, I create 100 concrete protocols, more than 1.20s will spent on loading phase, it will be worse when we actually use it in a real project.

So there is my solution, create a concreteprotocol2 macro to all the specific target classes(just increase a little bit writing complexity for making such a great high performance).

for example:

@concreteprotocol2( DemoProtocol, @"AppDelegate", @"Class1", @"Class2")

That will drop the traversing code, and take less than 1ms to load all the 100 concrete protocols.

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

No branches or pull requests

1 participant