Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add separate benchmark.net project to run against code and not nuget packages #349

Open
wants to merge 9 commits into
base: benchmarkdotnet
Choose a base branch
from
12 changes: 12 additions & 0 deletions Lucene.Net.sln
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{4D0ED7D9
src\dotnet\Lucene.Net.CodeAnalysis\tools\uninstall.ps1 = src\dotnet\Lucene.Net.CodeAnalysis\tools\uninstall.ps1
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lucene.Net.Tests.BenchmarkDotNet", "src\Lucene.Net.Tests.BenchmarkDotNet\Lucene.Net.Tests.BenchmarkDotNet.csproj", "{0C476146-411E-4C94-8A59-726A5F982A89}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lucene.Net.Tests.BenchmarkDotNet.Local", "src\Lucene.Net.Tests.BenchmarkDotNet.Local\Lucene.Net.Tests.BenchmarkDotNet.Local.csproj", "{3101FD09-F953-4313-A9BC-F0CC121E5E1A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -477,6 +481,14 @@ Global
{5CD4D4E8-6132-4384-98FC-6AB1C97E0B80}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5CD4D4E8-6132-4384-98FC-6AB1C97E0B80}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5CD4D4E8-6132-4384-98FC-6AB1C97E0B80}.Release|Any CPU.Build.0 = Release|Any CPU
{0C476146-411E-4C94-8A59-726A5F982A89}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0C476146-411E-4C94-8A59-726A5F982A89}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0C476146-411E-4C94-8A59-726A5F982A89}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0C476146-411E-4C94-8A59-726A5F982A89}.Release|Any CPU.Build.0 = Release|Any CPU
{3101FD09-F953-4313-A9BC-F0CC121E5E1A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3101FD09-F953-4313-A9BC-F0CC121E5E1A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3101FD09-F953-4313-A9BC-F0CC121E5E1A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3101FD09-F953-4313-A9BC-F0CC121E5E1A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Jobs;
using Lucene.Net.Demo.Facet;

namespace Lucene.Net.Tests.BenchmarkDotNet
{
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

[MemoryDiagnoser]
[Config(typeof(Config))]
public class FacetsAssociationsBenchmarks
{
private class Config : ManualConfig
{
public Config()
{
AddJob(Job.MediumRun);
}
}

public static readonly AssociationsFacetsExample example = new AssociationsFacetsExample();

[Benchmark]
public void RunSumAssociations() => example.RunSumAssociations();

[Benchmark]
public void RunDrillDown() => example.RunDrillDown();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Jobs;
using Lucene.Net.Demo.Facet;

namespace Lucene.Net.Tests.BenchmarkDotNet
{
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

[MemoryDiagnoser]
[Config(typeof(Config))]
public class FacetsDistanceBenchmarks
{
private class Config : ManualConfig
{
public Config()
{
AddJob(Job.MediumRun);
}
}

public static readonly DistanceFacetsExample example = new DistanceFacetsExample();

[GlobalSetup]
public void GlobalSetup() => example.Index();

[GlobalCleanup]
public void GlobalTearDown() => example.Dispose();

[Benchmark]
public void Search() => example.Search();

[Benchmark]
public void DrillDown() => example.DrillDown(DistanceFacetsExample.TWO_KM);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Jobs;
using Lucene.Net.Demo.Facet;

namespace Lucene.Net.Tests.BenchmarkDotNet
{
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

[MemoryDiagnoser]
[Config(typeof(Config))]
public class FacetsExpressionAggregationBenchmarks
{
private class Config : ManualConfig
{
public Config()
{
AddJob(Job.MediumRun);
}
}

public static readonly ExpressionAggregationFacetsExample example = new ExpressionAggregationFacetsExample();

[Benchmark]
public void RunSearch() => example.RunSearch();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Jobs;
using Lucene.Net.Demo.Facet;

namespace Lucene.Net.Tests.BenchmarkDotNet
{
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

[MemoryDiagnoser]
[Config(typeof(Config))]
public class FacetsMultiCategoryListsBenchmarks
{
private class Config : ManualConfig
{
public Config()
{
AddJob(Job.MediumRun);
}
}

public static readonly MultiCategoryListsFacetsExample example = new MultiCategoryListsFacetsExample();

[Benchmark]
public void RunSearch() => example.RunSearch();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Jobs;
using Lucene.Net.Demo.Facet;

namespace Lucene.Net.Tests.BenchmarkDotNet
{
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

[MemoryDiagnoser]
[Config(typeof(Config))]
public class FacetsRangeBenchmarks
{
private class Config : ManualConfig
{
public Config()
{
AddJob(Job.MediumRun);
}
}

public static readonly RangeFacetsExample example = new RangeFacetsExample();

[GlobalCleanup]
public void GlobalTearDown() => example.Dispose();

[Benchmark]
public void Search()
{
example.Index();
example.Search();
}

[Benchmark]
public void DrillDown()
{
example.Index();
example.DrillDown(example.PAST_SIX_HOURS);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Jobs;
using Lucene.Net.Demo.Facet;

namespace Lucene.Net.Tests.BenchmarkDotNet
{
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

[MemoryDiagnoser]
[Config(typeof(Config))]
public class FacetsSimpleBenchmarks
{
private class Config : ManualConfig
{
public Config()
{
AddJob(Job.MediumRun);
}
}

public static readonly SimpleFacetsExample example = new SimpleFacetsExample();

[Benchmark]
public void RunFacetOnly() => example.RunFacetOnly();

[Benchmark]
public void RunSearch() => example.RunSearch();

[Benchmark]
public void RunDrillDown() => example.RunDrillDown();

[Benchmark]
public void RunDrillSideways() => example.RunDrillSideways();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Jobs;
using Lucene.Net.Demo.Facet;

namespace Lucene.Net.Tests.BenchmarkDotNet
{
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

[MemoryDiagnoser]
[Config(typeof(Config))]
public class FacetsSimpleSortedSetBenchmarks
{
private class Config : ManualConfig
{
public Config()
{
AddJob(Job.MediumRun);
}
}

public static readonly SimpleSortedSetFacetsExample example = new SimpleSortedSetFacetsExample();

[Benchmark]
public void RunSearch() => example.RunSearch();

[Benchmark]
public void RunDrillDown() => example.RunDrillDown();
}
}
Loading