Skip to content

Instantly share code, notes, and snippets.

Understanding Comparative Benchmarks

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

@edwardGunawan
edwardGunawan / WriteToFileComplete.scala
Created October 11, 2020 16:14
How to Write Data to a File with FS2
object WriteToFile {
def create[F[_]](
queue: Queue[F, Option[Either[Throwable, String]]],
destinationFile: String
)(implicit blocker: Blocker,
F: Concurrent[F],
cs: ContextShift[F]): F[WriteToFile[F]] = {
def toFile(fileName: String): Pipe[F, String, Unit] =
_.through(text.utf8Encode)
@edwardGunawan
edwardGunawan / toFile.scala
Created October 11, 2020 16:06
How to Write Data to a File with FS2
def toFile(fileName:Sting, upstream:Stream[IO,String])(implicit blocker: Blocker):Stream[IO, Unit] =
upstream.through(text.utf8Encode).through(io.file.writeAll(Paths.get(fileName), blocker))
@Daenyth
Daenyth / 1-MapTraverse.md
Last active June 25, 2024 13:05
Scala (cats) map/traverse parallels

Parallels between map and similar functions

map          :: F[A] => (A =>     B)   => F[B]
flatMap      :: F[A] => (A =>   F[B])  => F[B]
traverse     :: G[A] => (A =>   F[B])  => F[G[B]]
flatTraverse :: G[A] => (A => F[G[B]]) => F[G[B]]
traverse_    :: F[A] => (A =>   F[B])  => F[Unit]
@bmaupin
bmaupin / free-database-hosting.md
Last active November 5, 2025 14:00
Free database hosting
@ivelin
ivelin / mydapp
Created August 2, 2018 13:13
NYU Dapp
pragma solidity ^0.4.17;
contract Auction {
// Data
//Structure to hold details of the item
struct Item {
uint itemId; // id of the item
uint[] itemTokens; //tokens bid in favor of the item
}
from web3 import Web3, HTTPProvider, IPCProvider
web3 = Web3(IPCProvider('/Users/xen/Library/Ethereum/rinkeby/geth.ipc'))
# web3 = Web3(IPCProvider('/Users/xen/Library/Ethereum/geth.ipc'))
print(web3.eth.blockNumber)
print(web3.eth.accounts)

Thread Pools

Thread pools on the JVM should usually be divided into the following three categories:

  1. CPU-bound
  2. Blocking IO
  3. Non-blocking IO polling

Each of these categories has a different optimal configuration and usage pattern.

@robertpainsi
robertpainsi / commit-message-guidelines.md
Last active October 27, 2025 18:09
Commit message guidelines

Commit Message Guidelines

Short (72 chars or less) summary

More detailed explanatory text. Wrap it to 72 characters. The blank
line separating the summary from the body is critical (unless you omit
the body entirely).

Write your commit message in the imperative: "Fix bug" and not "Fixed
bug" or "Fixes bug." This convention matches up with commit messages
@andredumas
andredumas / README.md
Last active September 11, 2018 14:27
TechanJS Bollinger Bands

Bollinger Bands calculation and rendering demo.