KB Article T731177
Visible to All Users

Performance enhancements in XAF v19.1 for all supported platforms

XAF v19.1 ships with the following performance enhancements that affect all supported platforms:
1. The Application Model loader requires less memory and processes XAFML and cache files much faster with the XmlReader API.
To control this behavior, use the static DevExpress.ExpressApp.Model.ModelXmlReader.UseXmlReader property (True by default).

2. Enhanced Application Model caching accelerates various scenarios, especially with successive View openings.
To control this behavior, use the static DevExpress.ExpressApp.Model.Core.ModelNode.UseDefaultValuesCache property (True by default).

3. Our type discovery mechanism leverages multi-threaded processing and caching more to decrease startup time. This is most noticeable for apps with many modules and business objects.
To control multi-threaded processing, use the static DevExpress.ExpressApp.Core.ControllersManager.UseParallelBatchControllerCreation and DevExpress.ExpressApp.ApplicationModulesManager.UseParallelTypesCollector properties (True by default).

To disable types and assembly cache (enabled in Release mode only), set the static DevExpress.ExpressApp.ApplicationModulesManager.UseStaticCache and DevExpress.Persistent.Base.ReflectionHelper.UseAssemblyResolutionCache properties to False.

4.  If WinApplication.SplashScreen is set to null or a DXSplashSceen instance, the application and popup window templates may be created in parallel during the application initialization. To get additional benefits, migrate your custom ISplash implementations to DXSplashScreen.
To control this behavior, use the DevExpress.ExpressApp.Win.WinApplication.RunSetupInNewThread property (True by default). Refer to this Breaking Change for more information.

All these options are switched on by default. If you wish to switch them off, mind that they are hidden from the Intellisense and consider the following examples (YourSolutionName.Win/Program.xx):

C#
namespace MainDemo.Win { public class Program { [STAThread] public static void Main(string[] arguments) { DevExpress.ExpressApp.Model.ModelXmlReader.UseXmlReader = false; DevExpress.ExpressApp.Model.Core.ModelNode.UseDefaultValuesCache = false; DevExpress.ExpressApp.Core.ControllersManager.UseParallelBatchControllerCreation = false; DevExpress.ExpressApp.ApplicationModulesManager.UseParallelTypesCollector = false; DevExpress.ExpressApp.ApplicationModulesManager.UseStaticCache = false; DevExpress.Persistent.Base.ReflectionHelper.UseAssemblyResolutionCache = false; ... MainDemoWinApplication winApplication = new MainDemoWinApplication(); winApplication.RunSetupInNewThread = false; ...
Visual Basic
Namespace MainDemo.Win Public Class Program <STAThread> Public Shared Sub Main(ByVal arguments() As String) DevExpress.ExpressApp.Model.ModelXmlReader.UseXmlReader = False DevExpress.ExpressApp.Model.Core.ModelNode.UseDefaultValuesCache = False DevExpress.ExpressApp.Core.ControllersManager.UseParallelBatchControllerCreation = False DevExpress.ExpressApp.ApplicationModulesManager.UseParallelTypesCollector = False DevExpress.ExpressApp.ApplicationModulesManager.UseStaticCache = False DevExpress.Persistent.Base.ReflectionHelper.UseAssemblyResolutionCache = False '... Dim winApplication As New MainDemoWinApplication() winApplication.RunSetupInNewThread = False '...

Note that static caches are shared between all threads within the application domain. If you run unit tests in parallel, disable all static caches to avoid possible issues.

5. XAF Solution Wizard creates new projects much faster. For instance, an XAF solution for all platforms and dozens of modules should not take more than 10-20 seconds. Typical Windows + Web solutions will be created in less than 5 seconds.

Results on several complex customer apps
Application startup time for a customer app #1 with ~1000 business classes and 600 Controllers:
    v18.2: 20 sec without any optimizations including EnableModelCache.
    v19.1: 10 sec with all the optimizations enabled (up to 50% less).

Application startup time for a customer app #2 with ~900 business classes and 800 Controllers:
    v18.2: 17.3 sec without any optimizations including EnableModelCache.
    v19.1: 12.7 sec with all the optimizations enabled (up to 27% less).

Complex View load time for a customer app #2 with 50-100 items that require Application Model information:
   v18.2: first load - 2.7 sec; subsequent loads: 2 sec.
   v19.1: first load - 2.1 sec (up to 20% less); subsequent loads: 1.5 sec (up to 35% less).

All the performance measurements were done on Intel® Core™ i7-4770 CPU @ 3.40GHz, 3401 Mhz, 4 Core(s), 8 Logical Processor(s) with NGEN. For more information on importance of NGEN, refer to the Why does my code take longer to execute the first time it's run? article.

Regardless of these and any future enhancements, be sure to check out the best practices at How to measure and improve the application's performance.

See Also:
Default XAF configuration options and feature toggles

Show previous comments (5)
PE PE
Peter Edsbäcker 6 years ago

    Is there any global methods to clear all caches?
    We have tested to migrate to 19.1.5 but quite a lot of unit tests fail because of "item already existing in dictionary" if
    they are run after eachother (running them one by one works).
    This is not a threaded test run, each test are executed in order by one thread.

    at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)\r\n
    at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)\r\n
    at DevExpress.Xpo.Metadata.ReflectionClassInfo.QueryOwnMember(String memberName)\r\n
    at DevExpress.Xpo.Metadata.XPClassInfo.FindMember(String memberName)\r\n
    at DevExpress.Xpo.Metadata.XPClassInfo.GetDirectlyRefTypes()\r\n
    at DevExpress.Xpo.Metadata.XPClassInfo.FillRefTypes(Dictionary`2 filled)\r\n
    at DevExpress.Xpo.Metadata.XPClassInfo.GetRefTypes()\r\n
    at DevExpress.Xpo.Metadata.XPDictionary.ExpandTypesToEnsure(ICollection`1 inputTypesToEnsure, IDictionary`2 alreadyEnsuredTypes)\r\n
    at DevExpress.Xpo.SimpleDataLayer.UpdateSchema(Boolean doNotCreate, XPClassInfo[] types)\r\n
    at DevExpress.ExpressApp.Xpo.XPObjectSpaceProvider.DevExpress.ExpressApp.IObjectSpaceProvider.UpdateSchema()\r\n
    at DevExpress.ExpressApp.Updating.DatabaseUpdaterBase.UpdateCore(IObjectSpace updatingObjectSpace, IList`1 versionInfoList)\r\n
    at DevExpress.ExpressApp.Updating.DatabaseUpdater.Update()"    string

    DevExpress Support Team 6 years ago

      Hello Peter,

      I've created a separate ticket on your behalf (T804845: Is there any global methods to clear all caches? ). It has been placed in our processing queue and will be answered shortly.

      Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

      Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.