Skip to content

Instantly share code, notes, and snippets.

@arkadijs
arkadijs / linux-compile-bench.md
Last active June 4, 2025 17:51
Relative CPU speed with GCC

Compact x86 32-bit Linux v6 kernel compile times on tmpfs storage.

CPU Year Cores Threads Freq, GHz Boost RAM MT/s Elapsed, sec
2x AWS Graviton4 2023 2x 96 192 2.7 DDR5 5600 17
Ryzen 9 9950X 2024 16 32 4.3 4.7 DDR5 6000 60
2x Xeon Gold 6230 2019 2x 20 80 2.1 2.4 R.DDR4 2666 63
2x Xeon E5-2630 v4 2016 2x 10 40 2.2 2.4 DDR4 2133 126
Xeon W-11955M 2021 8 16 2.6 [^3]4.2 DDR4 3200 130
Xeon E5-2680 v4 2016 14 28 2.4 2.9 DDR4 2133 192
@arkadijs
arkadijs / aosc-mesa.md
Last active August 17, 2024 21:47
Mesa 3D retro survey

Mesa 3D retro survey

Surveying retro graphics cards...

Device 24.1.3 21.3.9 amber 20.3.5 [^1]
R600 Radeon HD2600 XT glxgears
- OpenGL 3.3, GLES 3.0 glquake[^2]
- RV630 [^10] lzdoom
@arkadijs
arkadijs / loopback.c
Last active July 24, 2024 07:43
PortAudio capture WASAPI synthetic [Loopback] device
#include <fcntl.h>
#include <io.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <windows.h>
#include "portaudio.h"
@arkadijs
arkadijs / sbc-bench.md
Last active September 4, 2024 20:06
Selected sbc-bench results

Based mostly on sbc-bench submissions and a few entries of my own testing. Ordered by 7-zip single threaded performance. Italic MHz font marks overclock.

Device Clock MHz Kernel Distro 7-zip multi single AES kB/s memcpy memset MB/s latency s/dual hugepg ns
Apple M1 Pro 3030/2060 5.18 Gentoo arm64 43800 5010 1064450 27110 71910 100/126
Pentium G4600 (Kaby Lake, 2017) 3600 4.19 Buster amd64 11810 4448 984820 15120 33380 76/83 64/73
Qualcomm Snapdragon 8cx Gen 3 3000/2440 6.3 Lunar arm64 35370 4312 1686160
@arkadijs
arkadijs / pipeline.go
Last active May 5, 2023 14:34
Streaming Writer-based pipeline in Go
package main
import (
"fmt"
"io"
"strings"
)
const rate = 2 // bytes per millisec of "audio"
@arkadijs
arkadijs / external-dns.yaml
Created December 18, 2020 22:27
Socks and HTTP proxy in Kubernetes with ingress via Traefik (with SNI) or via Nginx, also ExternalDNS
apiVersion: externaldns.k8s.io/v1alpha1
kind: DNSEndpoint
metadata:
name: proxy
spec:
endpoints:
- dnsName: proxy.superhub.io
recordTTL: 300
recordType: CNAME
targets:
@arkadijs
arkadijs / cache.js
Last active October 20, 2022 13:25
Serialize and Cache JavaScript Promise
const defaultTtl = 60 * 60;
const validAtLeast = 10 * 1000;
const retry = 5 * 1000;
function cache(retrieve) {
const context = {
expireAt: 0,
promise: null,
get() {
@arkadijs
arkadijs / Main.java
Created December 16, 2016 12:06
Dekker's algorithm
package dekker;
public class Main {
private static volatile boolean flag0 = false;
private static volatile boolean flag1 = false;
private static volatile int turn = 0;
private static long count = 0;
private static long count0 = 0;
private static long count1 = 0;
@arkadijs
arkadijs / channels.rs
Created September 10, 2016 15:43
Beauty of Rust
use std::char;
use std::collections::HashMap;
use std::thread;
use std::sync::{Arc, Barrier};
use std::sync::mpsc::{channel, Sender};
const NTHREADS: u32 = 5;
fn slow(n: u32) -> char {
thread::sleep_ms(n);
@arkadijs
arkadijs / s3_zip_streaming.go
Last active May 30, 2025 09:52
Streaming S3 reader for Go archive/zip
import (
"archive/zip"
"fmt"
awss3 "github.com/aws/aws-sdk-go/service/s3"
"io"
)
var s3 *awss3.S3
head, err := s3.HeadObject(