开发者

precompile reflection?

开发者 https://www.devze.com 2023-01-29 16:55 出处:网络
I notice in my unit test the first test with a class using reflection is slow. Is there a way i can tell the compiler these classes will 开发者_运维技巧all be used for reflection so precompile it now

I notice in my unit test the first test with a class using reflection is slow. Is there a way i can tell the compiler these classes will 开发者_运维技巧all be used for reflection so precompile it now so it wont lag during runtime? (I run these unit test often.)


I am not sure about being able to "precompile" individual classes. Maybe if they are all grouped under a single assembly.

What you could do is to split your tests into categories. One category could be running speed. Run faster tests more often and slower tests less often (leave them running over night or run them just once a day etc.)


To precompile reflection sounds like an oxymoron. How about mocking the slow parts?

0

精彩评论

暂无评论...
验证码 换一张
取 消