Improving performance by caching or delegate call?

前端 未结 4 865
孤街浪徒
孤街浪徒 2021-01-23 10:37

I am trying to improve performance in the code below and kinda know how but not sure which is the best approach. The first hit will take longer but subsequent hits should be qui

4条回答
  •  终归单人心
    2021-01-23 11:16

    I've created similar logic before where I've cached an 'execution plan' for each type encountered. It was definitely faster for subsequent runs but you would have to profile your scenario to see whether it's worth the extra code complexity and memory usage.

提交回复
热议问题