Skip to content

Instantly share code, notes, and snippets.

View sleipnir's full-sized avatar
🎯
Focusing

Adriano Santos sleipnir

🎯
Focusing
View GitHub Profile
@ryanwinchester
ryanwinchester / bandit_mask.exs
Last active December 8, 2023 18:44
Benchmark Bandit WebSocket Frame Mask
Mix.install([
{:benchee, "~> 1.2"}
])
# ------------------------------------------------------------------------------
# Original code
# ------------------------------------------------------------------------------
defmodule Original do
# Masking is done @mask_size bits at a time until there is less than that number of bits left.
defmodule Client do
def main(pid) do
cmd = IO.gets("Enter a command: ") |> String.trim()
case String.split(cmd) do
["show"] ->
key = self()
Task.async(fn ->
send(pid, {:list, key, self()})
use lunatic::net::{TcpListener, TcpStream};
use lunatic::process::{self, Process};
use lunatic::Mailbox;
use std::io::{BufRead, BufReader, Write};
use std::net::SocketAddr;
#[derive(serde::Serialize, serde::Deserialize)]
struct Request {
from: Process<String>,
data: String,
@jossef
jossef / force-delete-k8s-namespace.py
Created August 13, 2020 12:50
force delete k8s namespace
#!/usr/bin/env python3
import atexit
import json
import requests
import subprocess
import sys
namespace = sys.argv[1]
proxy_process = subprocess.Popen(['kubectl', 'proxy'])
atexit.register(proxy_process.kill)
Pipeline Pipeline io_uring Non-pipelined Non-pipelined io_uring
CPU 99 50 (-50%) 97 48 (-50%)
RPS 2,592,670 2,878,222 (+11%) 497,429 631,976 (+26%)
Working set 79 81 79 81
Latency (mean) 1.28 0.98 1.07 1.47
Latency (99th) n/a 7.57 14.8 14.67