Remove timing code. There is likely more to optimize here. The current break down for time spent is, 51.9% in XmlFileUtil::SaveToFile (all of that in GetXMLInternal), 23.7% in RadarValues::CreateNode (with half of that in ssprintf alone!), 12.8% in XNode::Free and the rest is spread around pretty evenly. For reference, before these changes, it was taking about 3.5 seconds to write my catalog.xml and now it's taking under 1.5 (that's .8 seconds for writing and .5 for creating the XNodes for Songs, if anyone was wondering).

This commit is contained in:
Steve Checkoway
2007-02-04 13:36:16 +00:00
parent 424f04219b
commit 450ebed713
+5 -11
View File
@@ -22,7 +22,6 @@
#include "UnlockManager.h"
#include "arch/LoadingWindow/LoadingWindow.h"
#include "LocalizedString.h"
#include "RageTimer.h"
#define SHOW_PLAY_MODE(pm) THEME->GetMetricB("CatalogXml",ssprintf("ShowPlayMode%s",PlayModeToString(pm).c_str()))
#define SHOW_STYLE(ps) THEME->GetMetricB("CatalogXml",ssprintf("ShowStyle%s",Capitalize((ps)->m_szName).c_str()))
@@ -50,9 +49,6 @@ void CatalogXml::Save( LoadingWindow *loading_window )
RString fn = CATALOG_XML_FILE;
LOG->Trace( "Writing %s ...", fn.c_str() );
RageTimer timer;
float f;
#define TIME(x) {f = timer.Ago(); LOG->Trace( "Writing " #x " took %f seconds.", f ); timer.Touch();}
XNode xml( "Catalog" );
const vector<StepsType> &vStepsTypesToShow = CommonMetrics::STEPS_TYPES_TO_SHOW.GetValue();
@@ -165,7 +161,7 @@ void CatalogXml::Save( LoadingWindow *loading_window )
pNode->AppendChild( "NumUnlockedSteps", iNumUnlockedSteps );
pNode->AppendChild( "NumUnlockedCourses", iNumUnlockedCourses );
}
TIME(Totals)
{
XNode* pNode = xml.AppendChild( "Songs" );
@@ -219,7 +215,6 @@ void CatalogXml::Save( LoadingWindow *loading_window )
}
}
}
TIME(Songs)
{
XNode* pNode = xml.AppendChild( "Courses" );
@@ -271,7 +266,7 @@ void CatalogXml::Save( LoadingWindow *loading_window )
}
}
}
TIME(Courses)
{
XNode* pNode = xml.AppendChild( "Types" );
@@ -391,17 +386,16 @@ void CatalogXml::Save( LoadingWindow *loading_window )
}
}
}
TIME(Types)
xml.AppendChild( "InternetRankingHomeUrl", INTERNET_RANKING_HOME_URL );
xml.AppendChild( "InternetRankingUploadUrl", INTERNET_RANKING_UPLOAD_URL );
xml.AppendChild( "InternetRankingViewGuidUrl", INTERNET_RANKING_VIEW_GUID_URL );
xml.AppendChild( "ProductTitle", PRODUCT_TITLE );
xml.AppendChild( "FooterText", FOOTER_TEXT );
xml.AppendChild( "FooterLink", FOOTER_LINK );
TIME(Misc)
XmlFileUtil::SaveToFile( &xml, fn, CATALOG_XSL, false );
TIME(to disk)
#undef TIME
LOG->Trace( "Done." );
}