Skip to content

Commit

Permalink
Investigate jackmott#25: [Enhancement] Please also target .net4.8 and…
Browse files Browse the repository at this point in the history
… Benchmark

- Attempt to sort why Appveyor is unhappy.
- Sort out the ratio detection code when all are put back in.
  • Loading branch information
Smurf-IV committed Aug 7, 2019
1 parent 3bafae3 commit 9c9dd9d
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 115 deletions.
7 changes: 4 additions & 3 deletions Benchmarks/BenchmarkOrderBy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,24 @@
using System.Linq;

using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Configs;

using JM.LinqFaster;

namespace Tests
{
//[GroupBenchmarksBy(BenchmarkLogicalGroupRule.ByCategory)]
[GroupBenchmarksBy(BenchmarkLogicalGroupRule.ByCategory)]
public class BenchmarkOrderBy
{
private static readonly Func<int, int> orderBy = (x) => x - 1;

[Benchmark(Baseline = true)]
[BenchmarkCategory("intArray"), Benchmark(Baseline = true)]
public int IntArrayOrderByLinq()
{
return Benchmarks.intArray.OrderBy(orderBy).Sum();
}

[Benchmark]
[BenchmarkCategory("intArray"), Benchmark]
public int IntArrayOrderByFast()
{
return Benchmarks.intArray.OrderByF(orderBy).Sum();
Expand Down
7 changes: 3 additions & 4 deletions Benchmarks/BenchmarkSelect.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Collections.Generic;
using System.Linq;
using System.Linq;

using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Configs;
Expand All @@ -13,9 +12,9 @@ namespace Tests
public class BenchmarkSelect
{
[BenchmarkCategory("intArray.Select"), Benchmark(Baseline = true)]
public IEnumerable<int> IntArraySelectLinq()
public int[] IntArraySelectLinq()
{
return Benchmarks.intArray.Select(x => x * x);
return Benchmarks.intArray.Select(x => x * x).ToArray();
}

[BenchmarkCategory("intArray.Select"), Benchmark]
Expand Down
11 changes: 6 additions & 5 deletions Benchmarks/BenchmarkSequenceEqual.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Linq;

using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Configs;

using JM.LinqFaster;
using JM.LinqFaster.Parallel;
Expand All @@ -10,7 +11,7 @@

namespace Tests
{
//[GroupBenchmarksBy(BenchmarkLogicalGroupRule.ByCategory)]
[GroupBenchmarksBy(BenchmarkLogicalGroupRule.ByCategory)]
public class BenchmarkSequenceEqual
{
[Benchmark(Baseline = true)]
Expand All @@ -19,26 +20,26 @@ public bool IntArraySequenceEqual()
return Benchmarks.intArray.SequenceEqual(Benchmarks.array2);
}

[BenchmarkCategory("IntArrayAggregate"), Benchmark(Baseline = true)]
[BenchmarkCategory("intArray"), Benchmark]
public bool IntArraySequenceEqualF()
{
return Benchmarks.intArray.SequenceEqualF(Benchmarks.array2);
}


[BenchmarkCategory("IntArrayAggregate"), Benchmark(Baseline = true)]
[BenchmarkCategory("intArray"), Benchmark]
public bool IntArraySequenceEqualP()
{
return Benchmarks.intArray.SequenceEqualP(Benchmarks.array2);
}

[BenchmarkCategory("IntArrayAggregate"), Benchmark(Baseline = true)]
[BenchmarkCategory("intArray"), Benchmark]
public bool IntArraySequenceEqualS()
{
return Benchmarks.intArray.SequenceEqualS(Benchmarks.array2);
}

[BenchmarkCategory("IntArrayAggregate"), Benchmark(Baseline = true)]
[BenchmarkCategory("intArray"), Benchmark]
public bool IntArraySequenceEqualSP()
{
return Benchmarks.intArray.SequenceEqualSP(Benchmarks.array2);
Expand Down
2 changes: 1 addition & 1 deletion Benchmarks/BenchmarkSum.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public int IntArraySumLinqSelect()
return Benchmarks.intArray.Sum(sumDivide);
}

[BenchmarkCategory("IntArrayAggregate"), Benchmark(Baseline = true)]
[BenchmarkCategory("IntArrayAggregate"), Benchmark]
public int IntArraySumFastSelect()
{
return Benchmarks.intArray.SumF(sumDivide);
Expand Down
94 changes: 0 additions & 94 deletions Benchmarks/Benchmarks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -64,82 +64,19 @@
<HintPath>..\packages\Microsoft.Win32.Registry.4.5.0\lib\net461\Microsoft.Win32.Registry.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.AppContext, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.AppContext.4.3.0\lib\net46\System.AppContext.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Collections.Immutable, Version=1.2.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Collections.Immutable.1.5.0\lib\netstandard2.0\System.Collections.Immutable.dll</HintPath>
</Reference>
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Console, Version=4.0.1.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Console.4.3.1\lib\net46\System.Console.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Diagnostics.FileVersionInfo, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Diagnostics.FileVersionInfo.4.3.0\lib\net46\System.Diagnostics.FileVersionInfo.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Diagnostics.StackTrace, Version=4.0.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Diagnostics.StackTrace.4.3.0\lib\net46\System.Diagnostics.StackTrace.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.IO.Compression, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.Compression.4.3.0\lib\net46\System.IO.Compression.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.IO.FileSystem, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.FileSystem.4.3.0\lib\net46\System.IO.FileSystem.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.IO.FileSystem.Primitives, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.FileSystem.Primitives.4.3.0\lib\net46\System.IO.FileSystem.Primitives.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Management" />
<Reference Include="System.Numerics" />
<Reference Include="System.Reflection.Metadata, Version=1.4.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Reflection.Metadata.1.6.0\lib\netstandard2.0\System.Reflection.Metadata.dll</HintPath>
</Reference>
<Reference Include="System.Reflection.TypeExtensions, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Reflection.TypeExtensions.4.5.1\lib\net461\System.Reflection.TypeExtensions.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Security.AccessControl, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.AccessControl.4.5.0\lib\net461\System.Security.AccessControl.dll</HintPath>
</Reference>
<Reference Include="System.Security.Cryptography.Algorithms, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.Algorithms.4.3.1\lib\net461\System.Security.Cryptography.Algorithms.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Security.Cryptography.Encoding, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Security.Cryptography.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Security.Cryptography.X509Certificates, Version=4.1.1.2, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.X509Certificates.4.3.2\lib\net461\System.Security.Cryptography.X509Certificates.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Security.Principal.Windows, Version=4.1.1.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Principal.Windows.4.5.1\lib\net461\System.Security.Principal.Windows.dll</HintPath>
</Reference>
Expand All @@ -149,40 +86,9 @@
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.3\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Thread, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Thread.4.3.0\lib\net46\System.Threading.Thread.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.ReaderWriter, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Xml.ReaderWriter.4.3.1\lib\net46\System.Xml.ReaderWriter.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Xml.XmlDocument, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Xml.XmlDocument.4.3.0\lib\net46\System.Xml.XmlDocument.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Xml.XPath, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Xml.XPath.4.3.0\lib\net46\System.Xml.XPath.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Xml.XPath.XDocument, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Xml.XPath.XDocument.4.3.0\lib\net46\System.Xml.XPath.XDocument.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Xml.XPath.XmlDocument, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Xml.XPath.XmlDocument.4.3.0\lib\net46\System.Xml.XPath.XmlDocument.dll</HintPath>
</Reference>
Expand Down
4 changes: 2 additions & 2 deletions Benchmarks/BenchmarksMax.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,13 @@ public double IntSpanMaxFastSelector()
return asSpan.MaxF(MaxInts);
}

[BenchmarkCategory("intList"), Benchmark(Baseline = true)]
[BenchmarkCategory("intListSelect"), Benchmark(Baseline = true)]
public double IntListMaxLinqSelector()
{
return Benchmarks.intList.Max(MaxInts);
}

[BenchmarkCategory("intList"), Benchmark]
[BenchmarkCategory("intListSelect"), Benchmark]
public double IntListMaxFastSelector()
{
return Benchmarks.intList.MaxF(MaxInts);
Expand Down
12 changes: 7 additions & 5 deletions Benchmarks/BenchmarksRepeat.cs
Original file line number Diff line number Diff line change
@@ -1,35 +1,37 @@
using System.Linq;

using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Configs;

using JM.LinqFaster;
using JM.LinqFaster.SIMD;

namespace Tests
{
internal class BenchmarksRepeat
[GroupBenchmarksBy(BenchmarkLogicalGroupRule.ByCategory)]
public class BenchmarksRepeat
{

[Benchmark(Baseline = true)]
[BenchmarkCategory("intArray"), Benchmark(Baseline = true)]
public int[] IntArrayRepeatLinq()
{
return Enumerable.Repeat(5, Benchmarks.TEST_SIZE).ToArray();
}

[BenchmarkCategory("IntArrayAggregate"), Benchmark(Baseline = true)]
[BenchmarkCategory("intArray"), Benchmark]
public int[] IntArrayRepeatFast()
{
return LinqFaster.RepeatArrayF(5, Benchmarks.TEST_SIZE);
}


[BenchmarkCategory("IntArrayAggregate"), Benchmark(Baseline = true)]
[BenchmarkCategory("intArray"), Benchmark]
public int[] IntArrayRepeatFastSIMD()
{
return LinqFasterSIMD.RepeatS(5, Benchmarks.TEST_SIZE);
}

//[BenchmarkCategory("IntArrayAggregate"), Benchmark(Baseline = true)]
//[BenchmarkCategory("intArray"), Benchmark]
//public int[] IntArrayRepeatFastSIMDB()
//{
// return LinqFasterSIMD.RepeatSB(5, Benchmarks.TEST_SIZE);
Expand Down
2 changes: 1 addition & 1 deletion Benchmarks/BenchmarksWhereAggregate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public double IntArrayWhereAggregateLinq()
return Benchmarks.intArray.Where(x => x % 2 == 0).Aggregate(0.0, mulXInts, acc => acc / Benchmarks.intArray.Length);
}

[BenchmarkCategory("intArray.WhereAggregateSelect"), Benchmark(Baseline = true)]
[BenchmarkCategory("intArray.WhereAggregateSelect"), Benchmark]
public double IntArrayWhereAggregateFast()
{
return Benchmarks.intArray.WhereAggregateF(x => x % 2 == 0, 0.0, mulXInts, acc => acc / Benchmarks.intArray.Length);
Expand Down

0 comments on commit 9c9dd9d

Please sign in to comment.