Skip to content

Instantly share code, notes, and snippets.

View jackmott's full-sized avatar

Jack Mott jackmott

  • Looking for employment
  • Texas,USA
View GitHub Profile
package org.sample;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.OutputTimeUnit;
@jackmott
jackmott / Speed.java
Created September 8, 2016 12:31
morejavatest
import java.util.concurrent.TimeUnit;
import java.util.Arrays;
import java.util.Random;
import java.lang.*;
public class Speed {
public static void main(String[] args) {
@jackmott
jackmott / MyBenchmark.java
Last active September 6, 2016 13:59
JavaBench
package org.sample;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.OutputTimeUnit;
@jackmott
jackmott / NaiveJavaGame.java
Created September 5, 2016 18:50
Naive Java Game
class Vector
{
public float x, y, z;
public Vector(float x, float y, float z)
{
this.x = x;
this.y = y;
this.z = z;
}
@jackmott
jackmott / NaiveGame.cs
Created September 5, 2016 18:35
Naive CSharp Game
using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.Threading;
namespace csharpclarity
{
class Vector
{
public float x, y, z;
@jackmott
jackmott / JBlowFsharp.fs
Last active September 1, 2016 20:32
Example of poly_inc map combo in Fsharp
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>]
@jackmott
jackmott / maptest.md
Last active August 31, 2016 02:58
maptest fsharp

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 / linqtest.cs
Created August 31, 2016 01:15
LinqTestSource
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 / linq.md
Created August 31, 2016 01:13
LinqTests
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
@jackmott
jackmott / gotest.go
Last active August 28, 2016 12:25
go test
package main
import "fmt"
import "time"
func main() {
var values [32000000]float64
for i := 0; i < len(values); i++ {
values[i] = 2.0
}