Why is reflection slow?

后端 未结 5 1495
灰色年华
灰色年华 2020-12-03 10:09

Is it because we should load class (by string for example), create instance, then search for appropriate method, pack parameters, and then just invoke method? S

5条回答
  •  庸人自扰
    2020-12-03 10:45

    If you use it in an appropriate way, it is not that slow. For example, I used it for scanning all the property from model class, it was working perfectly.

    In other cases, such as checking whether the target has the same type or signature, it is absolutely slow.

    Event it is sometime slow, but it is important for out of the box implementation...:D.

提交回复
热议问题