The chief bottleneck in our grid performance is drawing the cell text. Microsoft introduced the TextRenderer (which directly uses GDI) as a replacement for GDI+ because "GDI text rendering typically offers better performance and more accurate text measuring than GDI+." (source: http://msdn.microsoft.com/en-us/library/ms171753.aspx)
When trying to use GDI in the UltraGrid, performance analysis appears to show a gain in the actual drawing of the text itself, however those gains are overwhelmingly negated by the creation and disposal of the WindowsGraphicsWrapper within the TextRenderer. This is due to that fact that Infragistics passes the Graphics object into the TextRenderer as the IDeviceContext and always sets flags that require the graphics properties be set back on the Graphics object after the TextRenderer is done.
This explicitly occurs in Infragisitics.Win.DrawUtility.TextFormatFlagsFromStringFormat() with an unconvincing comment:
// I think we always want to preserve the Graphics clipping // and transformations
textFormatFlags |= TextFormatFlags.PreserveGraphicsClipping;
textFormatFlags |= TextFormatFlags.PreserveGraphicsTranslateTransform;
Could this be revisited to determine if you "know" rather than "think" those flags need to be set? Not setting those flags would result in a substantial improvement in text drawing performance, and if those flags are unnecesarily being set it would be great if I could avoid having to write my own text drawing logic.
Hello Rastedt,
We have asked our engineering staff to examine this further. To ensure that it will receive attention, we have logged this behavior in our internal tracking system with a Development ID of 117765. The next step will be for a developer to review our investigation and confirm our findings or to offer a fix, or other resolution.
Thanks.
Hello ,
I have created a support ticket with id CAS-96669-D6GZTC, in order to be able to investigate this further for you. So I will update you via the case for the progress of this issue as soon as I have information for you.
Thank you for using Infragistics Components.