Skip to content

Instantly share code, notes, and snippets.

Jack Mott jackmott

Block or report user

Report or block jackmott

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jackmott
jackmott / bench.cs
Created Aug 23, 2016
C# benchmarks
View bench.cs
using System.Collections.Generic;
using System.Linq;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Diagnostics.Windows;
namespace bigo
View sort.hs
mergesort :: (a -> a -> Ordering) -> [a] -> [a]
mergesort cmp = mergesort' cmp . map wrap
mergesort' :: (a -> a -> Ordering) -> [[a]] -> [a]
mergesort' _ [] = []
mergesort' _ [xs] = xs
mergesort' cmp xss = mergesort' cmp (merge_pairs cmp xss)
merge_pairs :: (a -> a -> Ordering) -> [[a]] -> [[a]]
merge_pairs _ [] = []
@jackmott
jackmott / benchsample.cs
Last active Aug 24, 2016
sample benchmark
View benchsample.cs
using System.Collections.Generic;
using System.Linq;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Diagnostics.Windows;
namespace bigo
@jackmott
jackmott / perftest.fs
Created Aug 24, 2016
Pricer Perf Test
View perftest.fs
module Pricer.PerfTests
open System
open Pricer
open Pricer.Core
open BenchmarkDotNet.Attributes
open BenchmarkDotNet.Running
open BenchmarkDotNet.Configs
open BenchmarkDotNet.Jobs
View rusttest.rs
extern crate time;
//use std::io;
//use std::cmp::Ordering;
//use rand::Rng;
use time::{Duration,PreciseTime};
fn add_array() -> f64
View gotest.go
package main
import "fmt"
import "time"
func main() {
var values [32000000]float64
for i := 0; i < len(values); i++ {
values[i] = 2.0
}
View linq.md
Host Process Environment Information:
BenchmarkDotNet.Core=v0.9.9.0
OS=Microsoft Windows NT 6.2.9200.0
Processor=Intel(R) Core(TM) i7-4712HQ CPU 2.30GHz, ProcessorCount=8
Frequency=2240905 ticks, Resolution=446.2483 ns, Timer=TSC
CLR=MS.NET 4.0.30319.42000, Arch=64-bit RELEASE [RyuJIT]
GC=Concurrent Workstation
JitModules=clrjit-v4.6.1590.0
View linqtest.cs
using System.Collections.Generic;
using System.Linq;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Diagnostics.Windows;
namespace bigo
@jackmott
jackmott / maptest.md
Last active Aug 31, 2016
maptest fsharp
View maptest.md

Simple mapping function (fun x -> x*x) 1,000,000 ints

      Method |  Length |    Median |    StdDev | Scaled | Gen 0 | Gen 1 |  Gen 2 | Bytes Allocated/Op |

---------------- |-------- |---------- |---------- |------- |------ |------ |------- |------------------- | Parallelmap | 1000000 | 3.7892 ms | 0.4924 ms | 1.85 | - | - | 880.58 | 1,749,410.73 | map | 1000000 | 2.0427 ms | 0.0211 ms | 1.00 | - | - | 793.00 | 1,755,648.30 | SIMDmap | 1000000 | 1.7126 ms | 0.0175 ms | 0.84 | - | - | 777.53 | 1,721,123.56 | SIMDParallelmap | 1000000 | 1.6008 ms | 0.0267 ms | 0.78 | - | - | 926.58 | 1,590,658.22 |

More complex mapping function(fun x->x*(x*x+x+x/5.0f)) 1,000,000 float32s

@jackmott
jackmott / JBlowFsharp.fs
Last active Sep 1, 2016
Example of poly_inc map combo in Fsharp
View JBlowFsharp.fs
let inline map (array : 'T[]) f : 'U[] =
let result = Array.zeroCreate array.Length
for i = 0 to array.Length-1 do
result.[i] <- f array.[i]
result
let inline poly_incr x =
x + LanguagePrimitives.GenericOne
[<EntryPoint>]
You can’t perform that action at this time.