Thread pools on the JVM should usually be divided into the following three categories:
- CPU-bound
- Blocking IO
- Non-blocking IO polling
Each of these categories has a different optimal configuration and usage pattern.
| object test { | |
| import scalaz.zio._ | |
| type UserID = String | |
| case class UserProfile(name: String) | |
| // The database module: | |
| trait Database { | |
| val database: Database.Service |
A list of commonly asked questions, design decisions, reasons why Clojure is the way it is as they were answered directly by Rich (even when from many years ago, those answers are pretty much valid today!). Feel free to point friends and colleagues here next time they ask (again). Answers are pasted verbatim (I've made small adjustments for readibility, but never changed a sentence) from mailing lists, articles, chats.
How to use:
| go test -run=. -bench=. -benchtime=5s -count 5 -benchmem -cpuprofile=cpu.out -memprofile=mem.out -trace=trace.out ./package | tee bench.txt | |
| go tool pprof -http :8080 cpu.out | |
| go tool pprof -http :8081 mem.out | |
| go tool trace trace.out | |
| go tool pprof $FILENAME.test cpu.out | |
| # (pprof) list <func name> | |
| # go get -u golang.org/x/perf/cmd/benchstat | |
| benchstat bench.txt |
For testing purposes, the easiest way to go is jitpack:
resolvers += "jitpack" at "https://jitpack.io"
libraryDependencies += "com.github.User" % "Repo" % "Tag"Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.
A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.
val square : Int => Int = x => x * x| FROM hseeberger/scala-sbt | |
| # For a Alpine Linux version, comment above and uncomment below: | |
| # FROM 1science/sbt | |
| RUN mkdir -p /exampleapp | |
| RUN mkdir -p /exampleapp/out | |
| WORKDIR /exampleapp | |
| COPY . /exampleapp |
| object TypeclasseDemo { | |
| // The parts of the type class pattern are: | |
| // | |
| // 1. the "type class" itself -- a trait with a single type parameter; | |
| // | |
| // 2. type class "instances" for each type we care about, | |
| // each marked with the `implicit` keyword; | |
| // | |
| // 3. an "interface" to the type class -- one or more methods |
| // from and to are objects that live somewhere else (for examples sake) | |
| uiGmapGoogleMapApi.then(function(maps){ | |
| var directionsService = new maps.DirectionsService(); | |
| var request = { | |
| origin: new maps.LatLng( | |
| from.lat(), | |
| from.lng() | |
| ), |