QuiCM / EssentialsPlus

Essentials and MoreAdminCommands plugins for Terraria, merged and bettered
12 stars 28 forks source link

Improve database performance #5

Closed AxisKriel closed 9 years ago

AxisKriel commented 9 years ago

Suggested change: http://stackoverflow.com/questions/14032709/performance-of-find-vs-firstordefault

Basically, I'm not too sure if those would make any significant difference in the long run, but possibly once the list skyrockets on large servers? The principle I'm using is that if we're storing values on a list, we should use the methods given above extensions whenever possible. This allows us to perform a direct search instead of searching and then converting to list on FindAll vs Where.ToList's case, and Find vs FirstToDefault results on a performance increase.

Thoughts?

QuiCM commented 9 years ago

Did you do benchmark testing with FindAll?

QuiCM commented 9 years ago

I did some benchmarks, looks like FindAll and Find are faster across a list of ~1,000,000 items. Unless anyone has anything else to add, I'll merge this tomorrow.