needle icon indicating copy to clipboard operation
needle copied to clipboard

Needle should generate a alternate version of the generated code that's more runtime reliant

Open rudro opened this issue 3 years ago • 1 comments

The total volume of code needle produces is O(average_number_of_items_in_the_dependency_protocols x total_number_of_paths_in_the_component_tree). At Uber, the first one is slightly high maybe, but the second part is really high in our flagship apps. This is due to the total number of unique components being high and some nodes being repeated in many places.

Instead of such explicit code that we can rely on the Swift compiler to perform a second layer of safety checks for us with, we could create dictionaries at each component. Then we could rely on dynamic member lookup and then, at runtime, walk up the tree of components (to ancestors) and check on these dictionaries and check if the dictionary has the item we are looking for.

rudro avatar Jul 20 '22 06:07 rudro

Could you tell me how to use this feature? It's not in the doc yet. It seems that I don't have to call register with this feature.

haifengkao avatar Oct 22 '22 11:10 haifengkao