开发者

does asp mvc model size affect performance

开发者 https://www.devze.com 2023-03-14 15:24 出处:网络
I\'ve been developing a website and instead of having lots of models i\'ve been chaining properties and wh开发者_如何学Goat not to a single model by populating a prop and returning itself. not very im

I've been developing a website and instead of having lots of models i've been chaining properties and wh开发者_如何学Goat not to a single model by populating a prop and returning itself. not very important to the question but

var data = model.withUser(user).withStuff(data)

i'm curious if having a model class with a lot of lines of code will affect performance of the web app?

Thoughts


I don't know about performance (you'd have to benchmark one approach versus the other to say for sure), but I can say that having one monolithic class is going to be a pain when it comes to testing and reasoning about how it works.

In general, prefer composition to inheritance (lots of small classes to one large class).


Well yes... more code to run == more execution time yet we are talking micro and mostly likely nano seconds of time here.

If you are worried about that you are either A. Facebook or B. Google. ;)

0

精彩评论

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