Skip to content

Commit

Permalink
#7: add benchmark results
Browse files Browse the repository at this point in the history
  • Loading branch information
ForNeVeR committed Nov 1, 2016
1 parent 9f10f81 commit a02a3bc
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 4 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# skalarprodukt [![Build status][badge-appveyor]][build-appveyor]
Experimental multidimensional arrays for F#

## Benchmarks

See current [benchmark results][benchmark-results].

## Example

```fsharp
Expand Down Expand Up @@ -28,6 +32,8 @@ m1 |> NDArray.iteri (fun (i, j) v -> printf "(%d, %d) = %d\n" i j v)
skalarprodukt is licensed under the terms of MIT License. See License.md file for
details.

[benchmark-results]: docs/benchmark-results.md

[build-appveyor]: https://ci.appveyor.com/project/ForNeVeR/skalarprodukt/branch/master

[badge-appveyor]: https://ci.appveyor.com/api/projects/status/o5w052c6padj2obo/branch/master?svg=true
63 changes: 63 additions & 0 deletions docs/benchmark-results.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
Benchmark results
=================

We're measuring skalarprodukt 2D matrix type performance versus the F# standard
`Array2D` module.

MatrixMapComparison
-------------------

```
Host Process Environment Information:
BenchmarkDotNet.Core=v0.9.9.0
OS=Microsoft Windows NT 6.2.9200.0
Processor=Intel(R) Core(TM) i7 CPU 870 2.93GHz, ProcessorCount=8
Frequency=2873500 ticks, Resolution=348.0077 ns, Timer=TSC
CLR=MS.NET 4.0.30319.42000, Arch=32-bit RELEASE
GC=Concurrent Workstation
JitModules=clrjit-v4.6.1586.0
Type=MatrixMapComparison Mode=Throughput
```

Method | M | Median | StdDev |
----------- |----- |------------------- |------------------ |
Array2DMap | 1 | 460.4795 ns | 7.8193 ns |
NDArrayMap | 1 | 16.5862 ns | 0.4396 ns |
Array2DMap | 2 | 551.9338 ns | 17.7544 ns |
NDArrayMap | 2 | 21.2846 ns | 0.7272 ns |
Array2DMap | 32 | 25,667.1365 ns | 632.6966 ns |
NDArrayMap | 32 | 1,704.7966 ns | 38.5505 ns |
Array2DMap | 100 | 248,312.4687 ns | 11,890.3537 ns |
NDArrayMap | 100 | 15,749.8741 ns | 335.9436 ns |
Array2DMap | 1000 | 25,620,628.1538 ns | 1,006,538.0405 ns |
NDArrayMap | 1000 | 2,739,240.3102 ns | 42,846.3636 ns |

MatrixMapiComparison
--------------------

```
Host Process Environment Information:
BenchmarkDotNet.Core=v0.9.9.0
OS=Microsoft Windows NT 6.2.9200.0
Processor=Intel(R) Core(TM) i7 CPU 870 2.93GHz, ProcessorCount=8
Frequency=2873500 ticks, Resolution=348.0077 ns, Timer=TSC
CLR=MS.NET 4.0.30319.42000, Arch=32-bit RELEASE
GC=Concurrent Workstation
JitModules=clrjit-v4.6.1586.0
Type=MatrixMapiComparison Mode=Throughput
```

Method | M | Median | StdDev |
------------ |----- |-------------------- |------------------- |
Array2DMapi | 1 | 470.0634 ns | 10.8956 ns |
NDArrayMapi | 1 | 1,951.6315 ns | 38.2321 ns |
Array2DMapi | 2 | 549.7645 ns | 22.2139 ns |
NDArrayMapi | 2 | 5,030.7593 ns | 72.5182 ns |
Array2DMapi | 32 | 29,089.7782 ns | 998.9287 ns |
NDArrayMapi | 32 | 435,357.9177 ns | 15,355.9600 ns |
Array2DMapi | 100 | 278,707.0632 ns | 5,931.9032 ns |
NDArrayMapi | 100 | 3,922,312.7284 ns | 114,022.7973 ns |
Array2DMapi | 1000 | 28,081,194.5363 ns | 828,435.1225 ns |
NDArrayMapi | 1000 | 393,107,577.8663 ns | 10,661,166.4661 ns |
8 changes: 4 additions & 4 deletions skalarprodukt.Benchmark/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type MatrixMapComparison () =
let mutable arr1 : int [,] = Array2D.zeroCreate 1 1
let mutable arr2 : Matrix<int> = NDArray.zeroCreate (1, 1)

[<Params (2, 32)>]
[<Params (1, 2, 32, 100, 1000)>]
member val public M = 0 with get, set

[<Setup>]
Expand All @@ -34,7 +34,7 @@ type MatrixMapiComparison () =
let mutable arr1 : int [,] = Array2D.zeroCreate 1 1
let mutable arr2 : Matrix<int> = NDArray.zeroCreate (1, 1)

[<Params (2, 32)>]
[<Params (1, 2, 32, 100, 1000)>]
member val public M = 0 with get, set

[<Setup>]
Expand All @@ -53,6 +53,6 @@ type MatrixMapiComparison () =
let defaultSwitch () = BenchmarkSwitcher [| typeof<MatrixMapComparison>; typeof<MatrixMapiComparison> |]

[<EntryPoint>]
let main argv =
defaultSwitch().Run argv
let main argv =
defaultSwitch().Run argv
0

0 comments on commit a02a3bc

Please sign in to comment.