Skip to content

copyleftdev/asm_ftw

Repository files navigation

Assembly FTW: Where Machine Code Reigns Supreme

Welcome to Assembly FTW – the ultimate project that proves no matter how fancy your high-level language or trendy vibe coding gets, it's all just machine code in the end. While modern devs boast about their slick frameworks and LLM-powered abstractions, this project is a kick-ass reminder that true performance is built on raw, unadulterated assembly.


Table of Contents


The Vision

In an era where "vibe coding" is the new black and modern languages get all the hype, Assembly FTW pays homage to the unsung hero of computing – assembly language. This project is designed to showcase raw performance with:

  • A hyper-optimized loop performing 1 billion additions.
  • A mind-blowing factorial benchmark that computes 20! 50 million times.
  • A fully unrolled 4×4 matrix multiplication to push arithmetic complexity to its limits.

No fluff, no gimmicks—just the bare-metal performance that every byte of machine code is built on.


Benchmarks: Our Toys of Terror

1. Optimized Loop Benchmark

A lean, mean, addition machine that unrolls loops to perform 1 billion add operations. It’s pure, efficient, and designed to leave your high-level loops eating dust.

2. Optimized Factorial Benchmark

Compute the factorial of 20, not once, but 50 million times. It’s a tribute to the art of doing things the hard way—because if it's worth doing, it's worth doing in assembly.

3. Optimized Matrix Multiplication Benchmark

Watch as two 4×4 matrices are multiplied repeatedly in a fully unrolled operation that screams optimization. This benchmark isn’t just complex—it’s a masterclass in raw arithmetic power.


Project Structure

project/
├── src/
│   ├── optimized_loop.asm              # 1B add operations benchmark
│   ├── optimized_factorial_loop.asm     # Factorial benchmark: 20! computed 50M times
│   └── optimized_matrix_multiply.asm    # Fully unrolled 4x4 matrix multiplication benchmark
├── .gitignore                          # Ignore build artifacts and temporary files
├── Makefile                            # Build, run, and performance measurement automation
└── README.md                           # This epic manifesto

Each component is crafted with expert-level assembly and designed to make you remember that underneath the abstraction, every program is just a series of machine instructions.


Getting Started

Prerequisites

To build and run this project on Ubuntu, install the necessary packages:

sudo apt update
sudo apt install nasm binutils linux-tools-common linux-tools-$(uname -r) time

Building the Project

From the project root, simply run:

make all

This will assemble and link all benchmarks.

Running the Benchmarks

  • Run addition and factorial benchmarks:
    make run
  • Run matrix multiplication benchmark:
    make run-matrix

Performance Analysis

Collect performance metrics using:

make perf

Note: This target temporarily sets perf_event_paranoid to -1 (you’ll be prompted for sudo).

For detailed resource usage:

make time

Performance: The Hard Truth

Here’s what the numbers say:

  • Optimized Loop Benchmark: ~228 msec, 1.012B cycles at ~4.44 GHz, IPC ~1.49.
  • Optimized Factorial Benchmark: ~298 msec, 1.307B cycles at ~4.38 GHz, IPC ~3.22.
  • Optimized Matrix Multiplication Benchmark: ~150 msec, 644M cycles at ~4.29 GHz, IPC ~3.02.

These metrics aren’t just numbers—they’re a testament to the raw power and efficiency of well-written assembly code. Forget the high-level abstractions; when it comes down to performance, every operation is a byte of machine code dancing on your CPU.


Developer Manifesto

Once, the elite scoffed at those who dared to call themselves programmers if they used JavaScript or TypeScript. Now, in the era of vibe coding and LLM-powered abstractions, the same disdain echoes through modern corridors. But here’s the kicker: you’re doing exactly what the OGs did.

Remember:

  • Abstractions exist to simplify life.
  • Underneath every abstraction lies machine code—raw, unfiltered, and powerful.
  • Don’t forget where performance truly begins.

Embrace the power of assembly, and let these benchmarks remind you that no matter how far high-level languages evolve, machine code is the ultimate foundation.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published