From 80b48791f7518a6c7bfcc70ff7c8ee76646e8536 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 3 Oct 2018 18:37:56 +0000 Subject: [PATCH] --- server/AyaNova/biz/Search.cs | 29 +++++----------------- test/raven-integration/Search/SearchOps.cs | 20 +++++++++------ 2 files changed, 18 insertions(+), 31 deletions(-) diff --git a/server/AyaNova/biz/Search.cs b/server/AyaNova/biz/Search.cs index aecccf44..74c04da5 100644 --- a/server/AyaNova/biz/Search.cs +++ b/server/AyaNova/biz/Search.cs @@ -10,7 +10,7 @@ using Microsoft.Extensions.Logging; using Microsoft.EntityFrameworkCore; using AyaNova.Util; using AyaNova.Models; -using System.Diagnostics; +//using System.Diagnostics; namespace AyaNova.Biz @@ -336,24 +336,10 @@ namespace AyaNova.Biz - var watch = new System.Diagnostics.Stopwatch();//###################### PROFILING - watch.Start();//###################### PROFILING + // var watch = new System.Diagnostics.Stopwatch();//###################### PROFILING + // watch.Start();//###################### PROFILING - watch.Start();//###################### PROFILING - - - //EF CORE METHOD - // //Build the return list from the remaining matching objects list - // foreach (AyaTypeId i in OrderedMatchingObjects) - // { - // SearchResult SR = new SearchResult(); - // SR.Name = BizObjectNameFetcher.Name(i, ct);//THIS IS CAUSING ALL THE SLOWNESS IN RETURNING SEARCH RESULTS - // SR.Id = i.ObjectId; - // SR.Type = i.ObjectType; - // ResultList.Add(SR); - // } - - //TEST DIRECT METHOD ############## + //Get names using best performing technique using (var command = ct.Database.GetDbConnection().CreateCommand()) { @@ -371,11 +357,8 @@ namespace AyaNova.Biz } } - - watch.Stop();//###################### PROFILING - var TimeToBuildSearchResultReturnList = watch.ElapsedMilliseconds;//###################### PROFILING - - + // watch.Stop();//###################### PROFILING + // var TimeToBuildSearchResultReturnList = watch.ElapsedMilliseconds;//###################### PROFILING return ResultList; } diff --git a/test/raven-integration/Search/SearchOps.cs b/test/raven-integration/Search/SearchOps.cs index 0d1a8406..82ee5113 100644 --- a/test/raven-integration/Search/SearchOps.cs +++ b/test/raven-integration/Search/SearchOps.cs @@ -453,7 +453,6 @@ namespace raven_integration [Fact] public async void ConstrainedBigDataSearchShouldHonourMaxResultsAndBeRelativelyFast() { - //THIS test is a bit different in that it relies partly on the big dataset for testing //so it has different paths depending upon if it's testing against the big data or not const string TEST_SEARCH_PHRASE = "et*"; @@ -480,8 +479,11 @@ namespace raven_integration //assert it's not unbounded ResultCount.Should().BeLessOrEqualTo(1000); - //1755ms is the longest I've seen in initial testing with all 1000 results so setting slightly above - TimeToSearch.Should().BeLessThan(2476, "Constrained big data search should not be too slow"); + //1500 ms is the longest I've seen in initial testing with all 1000 results so setting 10% above + TimeToSearch.Should().BeLessThan(1650, "Constrained big data search should not be too slow"); + + //1291, 1384, 1343, 1466, 1479, 1500, 1313, 1381 + //when running all tests: 2456, 3620, }//eot @@ -489,7 +491,6 @@ namespace raven_integration [Fact] public async void UnboundBigDataSearchShouldBeRelativelyFast() { - //THIS test is a bit different in that it relies partly on the big dataset for testing //so it has different paths depending upon if it's testing against the big data or not const string TEST_SEARCH_PHRASE = "et*"; @@ -513,9 +514,10 @@ namespace raven_integration //Now validate the return list var ResultCount = ((JArray)a.ObjectResponse["result"]).Count; - - - TimeToSearch.Should().BeLessThan(38427, "Unconstrained big data search should not be too slow"); + + + //Set this time based on testing. Slowest run plus 10% + TimeToSearch.Should().BeLessThan(15400, "Unconstrained big data search should not be too slow"); //Fastest is 17227 ms with 14143 results /* Indexing improvements testing runs. @@ -527,7 +529,9 @@ namespace raven_integration 18647, 17137, 16836, 17379, 17637 = avg: 17527 Not a huge change, but it is positive - Adding more indexes... + After much work: + 11390, 10570, 11515 + 13926, 12411, 12007, 12438, 12023, 12492 */