Pending Review
Last Updated: 11 Dec 2017 22:00 by Joel
Created on: 11 Dec 2017 22:00
Category: Ajax
Type: Bug Report
PopulatePlainPanels to use HashSet instead of List
I have a RadGrid with several thousand elements on it. In attempting to improve performance, the Visual Studio profiler informed me that it spent more than half of the request in PopulatePlainPanels checking whether something was in a list. (see attached before.png)

I changed the type of the variable plainPanelsClientIDs in RadAjaxControl.cs to be a HashSet<string> instead of a List<string>. As a knock-on effect, I had to import System.Linq into RadAjaxManager.cs to get the .toArray() call to work.

The result in the attached after.png shows the percentage of execution time dropped from 55% to 3%.

I'd appreciate it if the team would evaluate this change for inclusion in future releases.

Note 1: I have not done extensive testing on this, so I don't know what might break. The variable isn't referenced much, so the only thing I'm suspicious of is reflection, which I didn't check for and don't expect.
Note 2: If importing Linq is undesirable, a more manual conversion to an array can be done pretty easily.
Note 3: plainPanelsClientIDs is .add() 'ed to in two places, and both check for membership before being called. This shouldn't be necessary for a HashSet, which simply doesn't add if it's there. This seems a very minor improvement, but I didn't actually try it yet.
Attached Files: