- Install IntelliJ + Scala Plugin
- Don’t do the Coursera courses yet.
- Don’t do the “red book” Functional Programming in Scala yet.
- Do: http://underscore.io/books/
- Essential Scala
- Essential Play
- Essential Slick
- Do Scala for the Impatient: https://www.amazon.com/Scala-Impatient-Cay-S-Horstmann/dp/0321774094
- The Neophyte’s Guide to Scala http://danielwestheide.com/scala/neophytes.html
Full source code can be found here
It popped up a discussion in FSSF Slack over 2D arrays and performance. I thought it could be good to share some performance numbers for different alternatives in .NET.
For this I am computing the matrix product:
let naiveMultiply () =Full source code can be found here
It is well-known that a hard disk has a long delay from that we request the data to that we get the data. Usually we measure the hard disk latency in milliseconds which is an eternity for a CPU. The bandwidth of a hard disk is decent good as SSD:s today can reach 1 GiB/second.
What is less known is that RAM has the same characteristics, bad latency with good bandwidth.
You can measure RAM latency and badndwidth using Intel® Memory Latency Checker. On my machine the RAM latency under semi-high load is ~120 ns (The 3r:1w bandwidth is 16GiB/second). This means that the CPU on my machine has to wait for ~400 cycles for data, an eternity.
Full source code can be found here
- 2016-12-20
- New performance test - Paul Westcott (@manofstick) made me aware that SeqComposer has a more performant API. SeqComposer2 uses this API.
- 2016-12-23
| module DapperFSharp = | |
| open System.Data.SqlClient | |
| open System.Dynamic | |
| open System.Collections.Generic | |
| open Dapper | |
| let dapperQuery<'Result> (query:string) (connection:SqlConnection) = | |
| connection.Query<'Result>(query) | |
| let dapperParametrizedQuery<'Result> (query:string) (param:obj) (connection:SqlConnection) : 'Result seq = |
| [<CLIMutable>] | |
| type Person = { Name : string; Age : int } | |
| //Nuget: ImpromptuInterface.FSharp | |
| use conn = new SqlCeConnection("Data Source=C:\Databases\MyDB.sdf;Persist Security Info=False;") | |
| conn.Open() | |
| let result = | |
| conn.Query("SELECT * FROM People") |
| namespace MyNamespace | |
| type IMyInterface = | |
| abstract GetValue: unit -> string | |
| type MyRecord = | |
| { MyField1: int | |
| MyField2: string } | |
| interface IMyInterface with | |
| member x.GetValue() = x.MyField2 |