This blog created for F# Advent 2016 (English)
Full source code can be found here
- 2016-12-10
- New performance test - Anthony Lloyd (@AnthonyLloyd) suggested that I compare against Prime.Vmap.
// ---------------------------------------------------------------------------------------------- | |
// Copyright 2017 Mårten Rånge | |
// | |
// Licensed under the Apache License, Version 2.0 (the "License"); | |
// you may not use this file except in compliance with the License. | |
// You may obtain a copy of the License at | |
// | |
// http://www.apache.org/licenses/LICENSE-2.0 | |
// | |
// Unless required by applicable law or agreed to in writing, software |
This blog created for F# Advent 2016 (English)
Full source code can be found here
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.
module FParsecTrace | |
open FParsec | |
open FParsec.Primitives | |
open FParsec.CharParsers | |
open System.Text | |
type DebugInfo = { Message: string; Indent: int } | |
type UserState = { mutable Debug: DebugInfo } |
(defn ws-listener | |
[_request _response ws-map] | |
(proxy [WebSocketAdapter] [] | |
(onWebSocketConnect [^Session ws-session] | |
(proxy-super onWebSocketConnect ws-session) | |
(when-let [f (:on-connect ws-map)] | |
(f ws-session))) | |
(onWebSocketClose [status-code reason] | |
(when-let [f (:on-close ws-map)] | |
(f (.getSession this) status-code reason))) |
(ns switch | |
(:require [clojure.pprint :as pprint])) | |
(defn project-clj-map [filename] | |
(->> (slurp filename) | |
(read-string) | |
(drop 1) | |
(partition 2) | |
(map vec) | |
(into {}))) |
(ns async-test.timeout.core | |
(:require [cljs.core.async :refer [chan close!]]) | |
(:require-macros | |
[cljs.core.async.macros :as m :refer [go]])) | |
(defn timeout [ms] | |
(let [c (chan)] | |
(js/setTimeout (fn [] (close! c)) ms) | |
c)) | |
//********************************************************// | |
// HOW TO: | |
// Create a file called devenv.pkgundef in the same directory as devenv.exe. | |
// It's usually located at C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE | |
// Then call "devenv.exe /updateconfiguration" from an elevated command prompt. | |
// REMARKS: | |
// Each GUID below represent a package that Visual Studio is loading. This is the | |
// list of package that I personally don't ever use. You can modify the list of |
(ns scratch) | |
(defn map [f] | |
(fn [xf] | |
(fn | |
([] (xf)) | |
([acc] (xf acc)) | |
([acc itm] | |
(xf acc (f itm)))))) |