dart-native / dart_native

Write iOS&macOS&Android Code using Dart. This package liberates you from redundant glue code and low performance of Flutter Channel.
BSD 3-Clause "New" or "Revised" License
951 stars 77 forks source link

Optimize creation of SEL #27

Closed zhongwuzw closed 4 years ago

zhongwuzw commented 4 years ago

We don't need to use SEL as the _cache key, use selectorName directly. We can prevent duplicate operations if same SEL already existed https://github.com/zhongwuzw/dart_native/blob/1e077faeb94b25274e9d45afe0cd24bd75ed5b9b/dart_native/lib/src/ios/runtime/selector.dart#L19-L21 .

yulingtianxia commented 4 years ago

We don't need to use SEL as the _cache key, use selectorName directly. We can prevent duplicate operations if same SEL already existed https://github.com/zhongwuzw/dart_native/blob/1e077faeb94b25274e9d45afe0cd24bd75ed5b9b/dart_native/lib/src/ios/runtime/selector.dart#L19-L21 .

This PR will optimize the performance of SEL(String selectorName), but it also increase the cost of SEL.fromPointer(Pointer<Void> ptr). I think most developers prefer to use SEL(String selectorName).