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 BasicNamespace 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
Hi,
This is impressive. Everything tested and demonstratated is on Win client.
In your first statement :
"XAF v19.1 ships with the following performance enhancements that affect all supported platforms:"
Can this also be applicable in Web client too? It would be great to have a piece of code applying this in Web client.
BR
ISA
@ISA:
In an ASP.NET WebForms app, you can set static and other options in the Session_Start method of the YourSolutionName.Web/Global.asax.xx file. Let us know your results or in case of any difficulties.
As all options are True by default i guess nothing needs to be applied for an WebClient or am i wrong?
@Noxe: Your understanding is correct. I guess ISA was asking how to disable them (similar to the example code above for WinForms).
Hi Dennis,
As I have not tested the 19.1 yet, I just wanted to know if something is needed to be done in web side. But @Martin aswered to it.
I will test this as soon as the eXpandFramework is ready for the 19.1.
BR
ISA
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
Take a look here: https://www.devexpress.com/Support/Center/Question/Details/T741715/19-1-3-unittests-performance-optimizations
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.