(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| open System.Collections.Generic | |
| open Microsoft.FSharp.Collections | |
| [<RequireQualifiedAccess>] | |
| module Folds = | |
| // These are the fast implementations we actually want to use |
04/26/2103. From a lecture by Professor John Ousterhout at Stanford, class CS142.
This is my most touchy-feely thought for the weekend. Here’s the basic idea: It’s really hard to build relationships that last for a long time. If you haven’t discovered this, you will discover this sooner or later. And it's hard both for personal relationships and for business relationships. And to me, it's pretty amazing that two people can stay married for 25 years without killing each other.
[Laughter]
> But honestly, most professional relationships don't last anywhere near that long. The best bands always seem to break up after 2 or 3 years. And business partnerships fall apart, and there's all these problems in these relationships that just don't last. So, why is that? Well, in my view, it’s relationships don't fail because there some single catastrophic event to destroy them, although often there is a single catastrophic event around the the end of the relation
| // Import all | |
| import Rx from "rxjs/Rx"; | |
| Rx.Observable | |
| .interval(200) | |
| .take(9) | |
| .map(x => x + "!!!") | |
| .bufferCount(2) | |
| .subscribe(::console.log); |
| module Logary.Obnoxious | |
| open Logary | |
| open Logary.Configuration | |
| open Logary.Targets | |
| open Hopac | |
| open Hopac.Infixes | |
| open Hopac.Job.Global | |
| open Hopac.Extensions.Async | |
| open Hopac.Extensions.Async.Global |
| /// Operations on Berkley sockets. | |
| [<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>] | |
| module Socket = | |
| /// Executes an async socket operation. | |
| let exec (alloc:unit -> SocketAsyncEventArgs, free:SocketAsyncEventArgs -> unit) (config:SocketAsyncEventArgs -> unit) (op:SocketAsyncEventArgs -> bool) (map:SocketAsyncEventArgs -> 'a) = | |
| Async.FromContinuations <| fun (ok, error, _) -> | |
| let args = alloc () |
| open Hopac | |
| open Hopac.Infixes | |
| open NodaTime | |
| open Logary | |
| open Logary.Metrics.Reservoirs | |
| open Logary.Configuration | |
| open Logary.Targets | |
| open Metric | |
| module PointName = |
| // getComponent is a function that returns a promise for a component | |
| // It will not be called until the first mount | |
| function asyncComponent(getComponent) { | |
| return class AsyncComponent extends React.Component { | |
| static Component = null; | |
| state = { Component: AsyncComponent.Component }; | |
| componentWillMount() { | |
| if (!this.state.Component) { | |
| getComponent().then(Component => { |
| module RuleIt = | |
| type Navigator = Navigator of (unit -> unit) | |
| type UserIdentity = UserIdentity of uint64 | |
| type ResourceIdentity = ResourceIdentity of uint64 | |
| type UserAction = | |
| | Create of ResourceIdentity | |
| | Read of ResourceIdentity | |
| | Update of ResourceIdentity | |
| | Delete of ResourceIdentity |
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.