开发者

MonoTouch - Fields vs Automatic Properties

开发者 https://www.devze.com 2023-01-03 20:11 出处:网络
Is there a noticeable performance difference when using fields instead of auto properties?What about if I\'m deserializing an array of say, 1000 JSON objects with 5 properties each?

Is there a noticeable performance difference when using fields instead of auto properties? What about if I'm deserializing an array of say, 1000 JSON objects with 5 properties each?

My iPhone domain model is basically a copy of the DTOs my web app uses 开发者_如何学Gofor serialization to javascript. They all use auto properties by habit. I'm concerned that I'm wasting CPU cycles using them in MonoTouch though.


I blogged about this very topic and Miguel himself commented on it saying that simple properties are inlined. My blog post suggested that properties are slower than fields. This caught the interest of the MonoTouch team and they took a look at it (I sent them my benchmark app to play with) and they disagreed with me, saying other factors were involved. I tend to believe them, so I do think using properties is just fine.

0

精彩评论

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