pmusolino / Wormholy

iOS network debugging, like a wizard 🧙‍♂️
MIT License
2.31k stars 184 forks source link

Performance degratation in CustomSelfAwareHelper.harmlessFunction() #96

Closed dsaitta0 closed 2 years ago

dsaitta0 commented 3 years ago

Hi,

I saw that there is a perfomance degratation due to a for loop used inside the static func harmlessFunction() declared in CustomSelfAwareHelper struct.

This loop is trying to verify the type with the as? operator (that have a complexity of O(n) ) and try to unwrapp the result in order to call the awake() function.

For a medium-larger project (with likely 20k+ classes) that covers old iDevices (like iPhone 5, 5S or 6) this means that the app launch phase could take a lot and should cause crashes if other frameworks needs to do an initialization in the application start up phase .

I saw also that in this project there is only one extension (on Wormholy.swift:109) that implements the type mentioned above (SelfAware): I think it would be nice to replace the for loop with a direct call to the awake() function implemented in the Wormholy externsion.

Let me know

Cheers

Daniele

pmusolino commented 3 years ago

Thank you Daniele for opening this issue. Are you using the latest version released 1.6.3?