|
| 1 | +using BenchmarkDotNet.Attributes; |
| 2 | +using BenchmarkDotNet.Configs; |
| 3 | +using BenchmarkDotNet.Jobs; |
| 4 | +using Lucene.Net.Demo.Facet; |
| 5 | + |
| 6 | +namespace Lucene.Net.Tests.BenchmarkDotNet |
| 7 | +{ |
| 8 | + /* |
| 9 | + * Licensed to the Apache Software Foundation (ASF) under one or more |
| 10 | + * contributor license agreements. See the NOTICE file distributed with |
| 11 | + * this work for additional information regarding copyright ownership. |
| 12 | + * The ASF licenses this file to You under the Apache License, Version 2.0 |
| 13 | + * (the "License"); you may not use this file except in compliance with |
| 14 | + * the License. You may obtain a copy of the License at |
| 15 | + * |
| 16 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 17 | + * |
| 18 | + * Unless required by applicable law or agreed to in writing, software |
| 19 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 20 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 21 | + * See the License for the specific language governing permissions and |
| 22 | + * limitations under the License. |
| 23 | + */ |
| 24 | + |
| 25 | + [MemoryDiagnoser] |
| 26 | + [Config(typeof(Config))] |
| 27 | + public class FacetsDistanceBenchmarks |
| 28 | + { |
| 29 | + private class Config : ManualConfig |
| 30 | + { |
| 31 | + public Config() |
| 32 | + { |
| 33 | + var baseJob = Job.MediumRun; |
| 34 | + |
| 35 | + AddJob(baseJob.WithNuGet("Lucene.Net.Analysis.Common", "4.8.0-beta00011").WithNuGet("Lucene.Net.Expressions", "4.8.0-beta00011").WithNuGet("Lucene.Net.Facet", "4.8.0-beta00011").WithId("4.8.0-beta00011")); |
| 36 | + AddJob(baseJob.WithNuGet("Lucene.Net.Analysis.Common", "4.8.0-beta00010").WithNuGet("Lucene.Net.Expressions", "4.8.0-beta00010").WithNuGet("Lucene.Net.Facet", "4.8.0-beta00010").WithId("4.8.0-beta00010")); |
| 37 | + AddJob(baseJob.WithNuGet("Lucene.Net.Analysis.Common", "4.8.0-beta00009").WithNuGet("Lucene.Net.Expressions", "4.8.0-beta00009").WithNuGet("Lucene.Net.Facet", "4.8.0-beta00009").WithId("4.8.0-beta00009")); |
| 38 | + AddJob(baseJob.WithNuGet("Lucene.Net.Analysis.Common", "4.8.0-beta00008").WithNuGet("Lucene.Net.Expressions", "4.8.0-beta00008").WithNuGet("Lucene.Net.Facet", "4.8.0-beta00008").WithId("4.8.0-beta00008")); |
| 39 | + AddJob(baseJob.WithNuGet("Lucene.Net.Analysis.Common", "4.8.0-beta00007").WithNuGet("Lucene.Net.Expressions", "4.8.0-beta00007").WithNuGet("Lucene.Net.Facet", "4.8.0-beta00007").WithId("4.8.0-beta00007")); |
| 40 | + AddJob(baseJob.WithNuGet("Lucene.Net.Analysis.Common", "4.8.0-beta00006").WithNuGet("Lucene.Net.Expressions", "4.8.0-beta00006").WithNuGet("Lucene.Net.Facet", "4.8.0-beta00006").WithId("4.8.0-beta00006")); |
| 41 | + AddJob(baseJob.WithNuGet("Lucene.Net.Analysis.Common", "4.8.0-beta00005").WithNuGet("Lucene.Net.Expressions", "4.8.0-beta00005").WithNuGet("Lucene.Net.Facet", "4.8.0-beta00005").WithId("4.8.0-beta00005")); |
| 42 | + } |
| 43 | + } |
| 44 | + |
| 45 | + public static readonly DistanceFacetsExample example = new DistanceFacetsExample(); |
| 46 | + |
| 47 | + [GlobalSetup] |
| 48 | + public void GlobalSetup() => example.Index(); |
| 49 | + |
| 50 | + [GlobalCleanup] |
| 51 | + public void GlobalTearDown() => example.Dispose(); |
| 52 | + |
| 53 | + [Benchmark] |
| 54 | + public void Search() => example.Search(); |
| 55 | + |
| 56 | + [Benchmark] |
| 57 | + public void DrillDown() => example.DrillDown(DistanceFacetsExample.TWO_KM); |
| 58 | + } |
| 59 | +} |
0 commit comments