I have a sequencing request to a list and get called many times. list = list.OrderBy().ToList(); In this code, the ToList () method spends a lot of resources and takes a lot of time. How can I speed up working with another sorting method without converting to a list. Should I use the .Sort extension for arrays?
list = list.OrderBy().ToList();
First of all, try sorting the list once and save it.
To speed things up, you can use Parallel LINQ.
see http://msdn.microsoft.com/en-us/magazine/cc163329.aspx
The OrderBy () Parallel parameter is as follows:
var query = data.AsParallel().Where(x => p(x)).Orderby(x => k(x)).ToList();
You only need to call ToList () only once to get a sorted list. All future actions should use sortedList.
sortedList = list.OrderBy().ToList();
Source: https://habr.com/ru/post/1339744/More articles:yahoo weather in different languages ββ- apiApplication architecture: saving serial connections in java - javaMemcache & php: Fatal error: Class 'Memcache' not found in - phpRuby on Rails: fully functional model without tables - ruby ββ| fooobar.comadd a list to hashset using addAll - javapython unzip - extremely slow? - pythonMySQL Left Join + Where is the problem - mysqlIterating over parts of a string - pythonprogramming in PayPal - phpJavascript: How to change the host name? - javascriptAll Articles