April 2026 TLDR setup for Ollama + Gemma 4 on a Mac mini (Apple Silicon) — auto-start, preload, and keep-alive
- Mac mini with Apple Silicon (M1/M2/M3/M4/M5)
- At least 16GB unified memory for Gemma 4 (default 8B)
- macOS with Homebrew installed
April 2026 TLDR setup for Ollama + Gemma 4 on a Mac mini (Apple Silicon) — auto-start, preload, and keep-alive
I'm going to do something that I don't normally do, which is to say I'm going to talk about comparative benchmarks. In general, I try to confine performance discussion to absolute metrics as much as possible, or comparisons to other well-defined neutral reference points. This is precisely why Cats Effect's readme mentions a comparison to a fixed thread pool, rather doing comparisons with other asynchronous runtimes like Akka or ZIO. Comparisons in general devolve very quickly into emotional marketing.
But, just once, today we're going to talk about the emotional marketing. In particular, we're going to look at Cats Effect 3 and ZIO 2. Now, for context, as of this writing ZIO 2 has released their first milestone; they have not released a final 2.0 version. This implies straight off the bat that we're comparing apples to oranges a bit, since Cats Effect 3 has been out and in production for months. However, there has been a post going around which cites various compar
| #!/usr/bin/env bash | |
| set -Eeuo pipefail | |
| trap cleanup SIGINT SIGTERM ERR EXIT | |
| script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P) | |
| usage() { | |
| cat <<EOF | |
| Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...] |
| // summary : Just ONE ammonite script file to execute a load performance test using gatling ! | |
| // keywords : scala, gatling, ammonite, scala, load-test, performance | |
| // publish : gist | |
| // authors : David Crosson | |
| // license : Apache License Version 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt) | |
| // id : ea7a4259-9461-44a8-99fa-1ec6ec3c48ed | |
| // created-on : 2018-09-22T07:41:07Z | |
| // managed-by : https://github.com/dacr/code-examples-manager | |
| // run-with : scala-cli $file |
| import cats.data.State | |
| import freestyle.tagless._ | |
| /* domain objects */ | |
| sealed trait Acme | |
| object Acme { | |
| case object AcmeUK extends Acme | |
| case object AcmeUS extends Acme | |
| } |
| scalaVersion := "2.11.8" | |
| scalaOrganization := "org.typelevel" | |
| libraryDependencies ++= Seq( | |
| "org.typelevel" %% "cats" % "0.9.0", | |
| "org.atnos" %% "eff" % "4.0.0" | |
| ) | |
| addCompilerPlugin("org.spire-math" %% "kind-projector" % "0.9.3") |
| object StaticFile { | |
| // Various necessary imports. Notes: | |
| // | |
| // 1. fs2 is necessary. See https://github.com/functional-streams-for-scala/fs2 | |
| // 2. streamz is necessary. See https://github.com/krasserm/streamz | |
| // 3. Apache Tika is used to infer MIME types from file names, because it's more reliable and | |
| // fully-featured than using java.nio.file.Files.probeContentType(). | |
| // | |
| // If using SBT, you'll want these library dependencies and resolvers: |
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| scala> import cats.implicits._ | |
| import cats.implicits._ | |
| scala> (1 -> 2) === (1 -> 3) | |
| res0: Boolean = true | |
| scala> import scala.reflect.runtime.universe._ | |
| import scala.reflect.runtime.universe._ | |
| scala> showCode(reify { (1 -> 2) === (1 -> 3) }.tree) |
| #!/bin/bash | |
| test -e ~/.coursier/cr || (mkdir -p ~/.coursier && wget -q -O ~/.coursier/cr https://git.io/vgvpD && chmod +x ~/.coursier/cr) | |
| CLASSPATH="$(~/.coursier/cr fetch -q -p \ | |
| \ | |
| com.typesafe.play:play-netty-server_2.11:2.5.0 \ | |
| com.typesafe.play:play_2.11:2.5.0 \ | |
| com.lihaoyi:ammonite-repl_2.11.7:0.5.2 \ | |
| \ | |
| )" java \ | |
| -Dplay.crypto.secret=foo.bar.baz \ |