instantly improve performance by 45% for regenerating xml structures for documents when a doc type alias changes

or when a doc type property alias is changed or a doc type property is removed.
This commit is contained in:
Shannon Deminick
2013-04-28 13:37:36 -10:00
parent 385d6396b0
commit 528209f8da
3 changed files with 47 additions and 9 deletions

View File

@@ -2150,11 +2150,8 @@
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
<PostBuildEvent>xcopy /s /y "$(ProjectDir)umbraco.presentation\*.aspx" "$(ProjectDir)..\Umbraco.Web.UI\"
xcopy /s /y "$(ProjectDir)umbraco.presentation\*.ascx" "$(ProjectDir)..\Umbraco.Web.UI\"
xcopy /s /y "$(ProjectDir)umbraco.presentation\*.asmx" "$(ProjectDir)..\Umbraco.Web.UI\"
xcopy /s /y "$(ProjectDir)umbraco.presentation\*.ashx" "$(ProjectDir)..\Umbraco.Web.UI\"
xcopy /s /y "$(ProjectDir)umbraco.presentation\*.master" "$(ProjectDir)..\Umbraco.Web.UI\"</PostBuildEvent>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />

View File

@@ -652,7 +652,28 @@ order by {1}
{
try
{
new Document(dr.GetInt("nodeId")).XmlGenerate(xd);
//create the document in optimized mode!
// (not sure why we wouldn't always do that ?!)
new Document(true, dr.GetInt("nodeId"))
.XmlGenerate(xd);
//The benchmark results that I found based contructing the Document object with 'true' for optimized
//mode, vs using the normal ctor. Clearly optimized mode is better!
/*
* The average page rendering time (after 10 iterations) for submitting /umbraco/dialogs/republish?xml=true when using
* optimized mode is
*
* 0.060400555555556
*
* The average page rendering time (after 10 iterations) for submitting /umbraco/dialogs/republish?xml=true when not
* using optimized mode is
*
* 0.107037777777778
*
* This means that by simply changing this to use optimized mode, it is a 45% improvement!
*
*/
}
catch (Exception ee)
{

View File

@@ -167,7 +167,7 @@ namespace umbraco.cms.businesslogic.web
while (dr.Read())
{
//check if the document id has already been added
if (documentTypes.Where(x => x.Id == dr.Get<int>("id")).Count() == 0)
if (documentTypes.Any(x => x.Id == dr.Get<int>("id")) == false)
{
//create the DocumentType object without setting up
DocumentType dt = new DocumentType(dr.Get<int>("id"), true);
@@ -183,7 +183,7 @@ namespace umbraco.cms.businesslogic.web
else
{
//we've already created the document type with this id, so we'll add the rest of it's templates to itself
var dt = documentTypes.Where(x => x.Id == dr.Get<int>("id")).Single();
var dt = documentTypes.Single(x => x.Id == dr.Get<int>("id"));
dt.PopulateDocumentTypeNodeFromReader(dr);
}
}
@@ -340,7 +340,27 @@ namespace umbraco.cms.businesslogic.web
var xd = new XmlDocument();
try
{
new Document(contentId).XmlGenerate(xd);
//create the document in optimized mode!
// (not sure why we wouldn't always do that ?!)
new Document(true, contentId).XmlGenerate(xd);
//The benchmark results that I found based contructing the Document object with 'true' for optimized
//mode, vs using the normal ctor. Clearly optimized mode is better!
/*
* The average page rendering time (after 10 iterations) for submitting /umbraco/dialogs/republish?xml=true when using
* optimized mode is
*
* 0.060400555555556
*
* The average page rendering time (after 10 iterations) for submitting /umbraco/dialogs/republish?xml=true when not
* using optimized mode is
*
* 0.107037777777778
*
* This means that by simply changing this to use optimized mode, it is a 45% improvement!
*
*/
}
catch (Exception ee)
{