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

How about improve concrete protocol macro? #144

Description

@JianboYan

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.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions