Skip to content

Commit a67e42a

Browse files
committed
Added benchmarks for facet operations using Lucene.Net.Demo.Facet classes as a basis
1 parent ebf808e commit a67e42a

8 files changed

+399
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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 FacetsAssociationsBenchmarks
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.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.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.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.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.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.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.Facet", "4.8.0-beta00005").WithId("4.8.0-beta00005"));
42+
}
43+
}
44+
45+
public static readonly AssociationsFacetsExample example = new AssociationsFacetsExample();
46+
47+
[Benchmark]
48+
public void RunSumAssociations() => example.RunSumAssociations();
49+
50+
[Benchmark]
51+
public void RunDrillDown() => example.RunDrillDown();
52+
}
53+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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 FacetsExpressionAggregationBenchmarks
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 ExpressionAggregationFacetsExample example = new ExpressionAggregationFacetsExample();
46+
47+
[Benchmark]
48+
public void RunSearch() => example.RunSearch();
49+
}
50+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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 FacetsMultiCategoryListsBenchmarks
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.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.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.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.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.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.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.Facet", "4.8.0-beta00005").WithId("4.8.0-beta00005"));
42+
}
43+
}
44+
45+
public static readonly MultiCategoryListsFacetsExample example = new MultiCategoryListsFacetsExample();
46+
47+
[Benchmark]
48+
public void RunSearch() => example.RunSearch();
49+
}
50+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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 FacetsRangeBenchmarks
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.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.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.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.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.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.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.Facet", "4.8.0-beta00005").WithId("4.8.0-beta00005"));
42+
}
43+
}
44+
45+
public static readonly RangeFacetsExample example = new RangeFacetsExample();
46+
47+
[GlobalCleanup]
48+
public void GlobalTearDown() => example.Dispose();
49+
50+
[Benchmark]
51+
public void Search()
52+
{
53+
example.Index();
54+
example.Search();
55+
}
56+
57+
[Benchmark]
58+
public void DrillDown()
59+
{
60+
example.Index();
61+
example.DrillDown(example.PAST_SIX_HOURS);
62+
}
63+
}
64+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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 FacetsSimpleBenchmarks
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.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.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.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.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.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.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.Facet", "4.8.0-beta00005").WithId("4.8.0-beta00005"));
42+
}
43+
}
44+
45+
public static readonly SimpleFacetsExample example = new SimpleFacetsExample();
46+
47+
[Benchmark]
48+
public void RunFacetOnly() => example.RunFacetOnly();
49+
50+
[Benchmark]
51+
public void RunSearch() => example.RunSearch();
52+
53+
[Benchmark]
54+
public void RunDrillDown() => example.RunDrillDown();
55+
56+
[Benchmark]
57+
public void RunDrillSideways() => example.RunDrillSideways();
58+
}
59+
}

0 commit comments

Comments
 (0)