Performance of compiled-to-delegate Expression

前端 未结 5 651
無奈伤痛
無奈伤痛 2020-12-02 10:07

I\'m generating an expression tree that maps properties from a source object to a destination object, that is then compiled to a Func

5条回答
  •  有刺的猬
    2020-12-02 10:35

    It sounds like you're running into invocation overhead. Regardless of the source, though, if your method runs faster when loaded from a compiled assembly, simply compile it into an assembly and load it! See my answer at Why is Func<> created from Expression> slower than Func<> declared directly? for more details on how.

提交回复
热议问题