From 450ebed7130345df46ff62c78aca3c6ff1d0522a Mon Sep 17 00:00:00 2001 From: Steve Checkoway Date: Sun, 4 Feb 2007 13:36:16 +0000 Subject: [PATCH] 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). --- stepmania/src/CatalogXml.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/stepmania/src/CatalogXml.cpp b/stepmania/src/CatalogXml.cpp index 6355eae9ec..9918c5c70b 100644 --- a/stepmania/src/CatalogXml.cpp +++ b/stepmania/src/CatalogXml.cpp @@ -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 &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." ); }