public void TestOPathPerformance() { HiPerfTimer rawTimer = new HiPerfTimer(); rawTimer.Start(); for (int i = 0; i < EVALUATION_COUNT; i++) { OPathExpression opathExpression = OPathExpression.Compile(EXPRESSION); OPathDocument opathDocument = new OPathDocument(); opathDocument.Add("listDictionary", m_ListDictionary); OPathNavigator opathNavigator = OPathNavigator.CreateNavigator(opathDocument); opathNavigator.Evaluate(opathExpression); } rawTimer.Stop(); Console.WriteLine("Uncompiled OPath performance {0} evaluations in {1:0.000} millis", EVALUATION_COUNT, (rawTimer.Duration * 1000)); HiPerfTimer cachedTimer = new HiPerfTimer(); cachedTimer.Start(); OPathExpression cachedOPathExpression = OPathExpression.Compile(EXPRESSION); for (int i = 0; i < EVALUATION_COUNT; i++) { OPathDocument opathDocument = new OPathDocument(); opathDocument.Add("listDictionary", m_ListDictionary); OPathNavigator opathNavigator = OPathNavigator.CreateNavigator(opathDocument); opathNavigator.Evaluate(cachedOPathExpression); } cachedTimer.Stop(); Console.WriteLine("Compiled OPath performance {0} evaluations in {1:0.000} millis", EVALUATION_COUNT, (cachedTimer.Duration * 1000)); }
public void OneTimeSetUp() { m_OPathDocument.Add("TrueBool", TRUE_BOOL); m_OPathDocument.Add("FalseBool", FALSE_BOOL); m_OPathDocument.Add("ZeroInt", ZERO_INT); m_OPathDocument.Add("NonZeroInt", NON_ZERO_INT); m_OPathDocument.Add("ZeroDouble", ZERO_DOUBLE); m_OPathDocument.Add("NonZeroDouble", NON_ZERO_DOUBLE); m_OPathDocument.Add("EmptyString", EMPTY_STRING); m_OPathDocument.Add("NonEmptyString", NON_EMPTY_STRING); m_OPathDocument.Add("MinDateTime", MIN_DATE_TIME); m_OPathDocument.Add("MaxDateTime", MIN_DATE_TIME); m_OPathDocument.Add("NonMinDateTime", NON_MIN_DATE_TIME); m_OPathDocument.Add("EmptyIntArray", EMPTY_INT_ARRAY); m_OPathDocument.Add("NonEmptyIntArray", NON_EMPTY_INT_ARRAY); m_OPathDocument.Add("NonEmpty2dIntArray", NON_EMPTY_2D_INT_ARRAY); m_OPathDocument.Add("EmptyIntList", EMPTY_INT_LIST); m_OPathDocument.Add("NonEmptyIntList", NON_EMPTY_INT_LIST); m_OPathDocument.Add("EmptyDictionary", EMPTY_DICTIONARY); m_OPathDocument.Add("NonEmptyDictionary", NON_EMPTY_DICTIONARY); m_OPathDocument.Add("NonEmptyListDictionary", NON_EMPTY_LIST_DICTIONARY); m_OPathDocument.Add("NullObject", null); m_OPathDocument.Add("ExceptionThrower", new ExceptionThrower()); }