Skip to content

Instantly share code, notes, and snippets.

View corporatepiyush's full-sized avatar
🎯
Focusing

Piyush Katariya corporatepiyush

🎯
Focusing
View GitHub Profile
@corporatepiyush
corporatepiyush / iofiledisk.md
Last active July 23, 2026 03:56
C17 Optimization Guide

I. Hardware, DMA & Architecture-Specific I/O (AMD64 vs. ARMv8/v9)

  • PCIe NUMA Affinity Pinning (AMD64/ARMv8): Pin network and storage worker threads directly to the CPU socket and core complex physically wired to the PCIe Root Complex handling the target device (/sys/class/net/<iface>/device/numa_node). This eliminates cross-socket UPI/QPI and CXL interconnect latency under high-throughput I/O.
  • Intel DDIO & AMD TPH (TLP Processing Hint) / L3 Direct Delivery: On x86_64, tune Intel Data Direct I/O (DDIO) or PCIe TLP Processing Hints (TPH) so that NIC/NVMe RX/TX ring descriptors and packet buffers land directly in designated CPU L3 cache lines, avoiding L1/L2 cache pollution while preventing PCIe-to-DRAM memory bottlenecks.
  • ARMv8/v9 Page Size & Folio Alignment (16KB vs. 64KB vs. 4KB): On Apple Silicon (16KB native page size) or Enterprise ARM64 Linux (4KB/64KB pages), align ring buffer memory allocations and kernel page-pinning boundaries (mmap, io_uring mapped rings, UMEM) strictly
@corporatepiyush
corporatepiyush / db_compare.md
Last active August 4, 2026 21:21
Database Comparison — SQLite · DuckDB · PostgreSQL · MariaDB · ClickHouse · MongoDB

Database Comparison — SQLite · DuckDB · PostgreSQL · MariaDB · ClickHouse · MongoDB

Version claims cross-checked against official release channels on 2026-07-15. Feature statements describe the versions listed in the table below. Where a database lacks a capability, or has it only in part, the closest practical alternative is given as Alternative:.

Database Stable Version Released Support Storage / Execution Model
SQLite 3.53.3 Jun 26, 2026 Format/API support pledged through 2050 Row-oriented B-trees, in-process, single file
@corporatepiyush
corporatepiyush / nushell_agent.md
Last active July 5, 2026 05:02
Add nushell reference globally in CLAUDE.md

Nushell for Terminal & Development Tasks

Reference: https://www.nushell.sh/commands/

Use Nushell for all terminal operations, scripting, and data manipulation. Nushell provides:

Core Capabilities:

  • Structured data pipelines (JSON, CSV, tables native)
  • File system operations and batch processing
  • String manipulation and regular expressions
@corporatepiyush
corporatepiyush / gorustzig.md
Last active June 17, 2026 02:53
The only guide you will ever need to compare Go, Rust and Zig programming language in a great detail

Rust 1.95 vs Go 1.26 vs Zig 0.16 — Complete Comparative Guide

As of June 2026

Each section compares how the three languages approach the same concern, side by side. Tags: ⚡ Perf · 🔐 Safety · 🧹 DX · 🔍 Debug · 📦 Binary · 🔒 SecOps

Notes on reading this document: performance figures are from specific benchmarks, not guarantees — they vary with workload, input size, and hardware. Library names are current as of June 2026; ecosystems move. Where a language lacks a capability, that is stated plainly rather than softened.

@corporatepiyush
corporatepiyush / pl_comp.md
Created June 11, 2026 09:06
Programming language comparison

|Aspect |Odin (dev-2026-05) |Zig (0.16.0) |Rust (1.95+) |Go (1.26+) heavy unsafe |Java (25 LTS) |C# (.NET 11 preview / C# 15) | |-----------------------------------|-----------------------------------------------------------------------------------------------------------------

@corporatepiyush
corporatepiyush / datastar.md
Last active June 16, 2026 10:39
The Ultimate Guide - Datastar framework for building complex UI with SSE, PostgreSQL and MongoDB

Datastar + Tailwind CSS — Complex UI Development Guide

Version: Datastar v1.0.x (latest stable) | Composable CSS: Tailwind CSS v4.x
Philosophy: Server-driven reactivity with declarative data-* attributes. No build step, no virtual DOM, ~10.7KB client.


Table of Contents

Quick Reference Cheatsheet — fast lookup for attributes, actions, SSE events & backend patterns

@corporatepiyush
corporatepiyush / AgentCompact.md
Last active June 20, 2026 02:36
AgentCompact

AGENT.md — Extreme Performance Reference (Compact Edition)

June 2026 · Java 25/26 · Go 1.26 · Rust 1.94 · Python 3.14 · Node 24 · Linux 7.0/6.18 LTS · PG 18.4 · MariaDB 12.3.2 LTS


Latency Numbers (2026 Hardware)

Operation Latency
@corporatepiyush
corporatepiyush / agent.md
Created June 8, 2026 13:33
Agent.md for CPU, IO and Memory optimizations

Core Objective: Treat every abstraction as a measurable, quantifiable cost. Prioritize mechanical sympathy, cache-line granularity, zero-allocation hot paths, kernel-boundary minimization, and compiler-friendly structures. Every byte of indirection, every cycle of branch misprediction, and every nanosecond of cache coherency traffic is a failure to respect the silicon. These principles apply universally—whether the runtime is a managed VM, a compiled binary with a GC, a borrow-checked systems language, or a native code generator.


Data Representation & CPU Cache Alignment

Mechanical Sympathy over Deep Hierarchies: Data must flow as contiguous byte streams. Prioritize flat arrays and dense vectors over deep object graphs, nested classes, or pointer-chasing models. A single pointer dereference can cost 100 ns from DRAM versus 1 ns from L1 cache. On x86-64, the L1 cache is 32–64 KB per core with 64-byte lines; on ARM64 (Neoverse V2), L1 is 64 KB with 128-byte lines. The hardware prefetcher loads

"""
The most atomic way to train and run inference for a GPT in pure, dependency-free Python.
This file is the complete algorithm.
Everything else is just efficiency.
@karpathy
"""
import os # os.path.exists
import math # math.log, math.exp
@corporatepiyush
corporatepiyush / For.java
Created October 16, 2025 21:26
Optimizing For loops
import java.util.Random;
public class For {
static final int SIZE = 1_000_000;
public static void main(String[] args) {
int[] data = new int[SIZE];
Random rnd = new Random(42);
for (int i = 0; i < SIZE; i++) data[i] = rnd.nextInt(1000) - 500;