How slow is Reflection

后端 未结 7 2032
时光取名叫无心
时光取名叫无心 2020-12-02 07:43

I recently created an interface layer to distinguish the DataAccessProvider from our Business logic layer. With this approach we can change our choice of DataAccessProvider

7条回答
  •  天命终不由人
    2020-12-02 08:20

    Reflection is not THAT slow. Invoking a method by reflection is about 3 times slower than the normal way. That is no problem if you do this just once or in non-critical situations. If you use it 10'000 times in a time-critical method, I would consider to change the implementation.

提交回复
热议问题